Can anyone explain to me what is the need of using type substitution?
e.g.
class Circle extends Shape{
...
}
.
.
.
class Main{
public static void main(String[] args){
Shape s = new Circle();
...
}
}
What possible benifit can we get from the above code? Normally,
public static void main(String[] args){
Circle c = new Circle();
}
would have done the required job easily.