Lets understand it with an example:
public abstract class cal { public cal() { } public cal(int a) { } public abstract int add(int a, int b); } public class c2 { cal c;// Yes we can create object of abstract class c = new cal() // error, we can't instantiate object of abstract class. }
as we can see in above example that we cannot instantiate the object of an abstract class, this is because if it allows to instantiate the object of abstract class and if you will call its function named "add" (abstract) then what will happen? as there is no function body/functionality is defined for that "add" method, as its functionality will be defined in its child class so CLI not allows us to instantiate the object of abstract class.
An abstract class has a protected constructor (by default) allowing derived types to initialize it.
An abstract type is defined largely as one that can't be created. You can create subtypes of it, but not of that type itself. The CLI will not let you do this.
3 comments:
Nice !!!
Very-2 Nice Post!!
Good info.. Keep going
Post a Comment