+ 2

Can we create a reference of abstract class?

An abstract class being a super-class can we use it to create a reference of super-class and an object of sub-class while instantiation or while passing an object of sub-class as a parameter and receive it in a method with a reference of that abstract super-class?

17th Jan 2018, 6:12 AM
Nikesh Prasad
1 Answer
+ 37
We can. Like this : ConcreteClass extends AbstractClass {...} AbstractClass a = new ConcreteClass();
17th Jan 2018, 8:24 AM
Igor Makarsky
Igor Makarsky - avatar