Why unable to create object for abstract class and interfaces?
Note : This is the question asked by a visitor bhnau priya. I am posting this in proper forum.
Why unable to create object for abstract class and interfaces?
Note : This is the question asked by a visitor bhnau priya. I am posting this in proper forum.
Unlike classes or objects, abstracts and interfaces are not something that exists in objective reality. They are only "scaffolding" needed to support c++/java static typing system. there's no need of them
Interface do not have any body ... it s has only variable declaration and method declartion ... we dont initialize them ... we have to put the code related to those variable and methods ... in the class which implements that interface ... so dont create an object of an Interface ...we just give an object type of that interface ...
If it comes to abstract class they do not have nay body similar to interfaces
to ... so we need not instantiate those abstarct class ....