I have just started to explore Scala. suppose I have the following code:
abstract class Shape
case class Square() extends Shape
case class Circle() extends Shape
case class Triangle() extends Shape
Having that, I can define a reference referring to Shape in java, and then I can store objects of Shape subclasses in it as bellow:
Shape s=null;
s=new Circle();
s=new Square();
s=new Triangle();
my Question: what is the above code counterpart in scala (note that I do want to define only one variable, namely s here)