Abstract Class:-
we use 'abstract'
keyword to implement the concept of abstract class. 'Abstract class' can only inherited by other class.we can
not create objects of 'abstract class' directly. When any 'abstract class' is inherited
by other class then we create the objects of that derived class.We can not
create objects of 'abstract
class' because methods
of 'abstract class' only declare but not define.
If any
class will inherited the 'abstract
class' then that derived
class will give the body of the 'abstract
class'member.
Some characteristics
of an 'abstract class' are:-
§ It can not be instantiate directly.
§ It can have abstract members.
§ we can not apply a sealed modifier to it.
Abstract Method:-
when we know what will
happen but do not know how it happen ,we just only declare the method but do
not define the method. In that case abstract keyword declare with method.
when an instance method declaration includes the modifier abstract,the method is said to be an abstract method.
Some characteristics of abstract method are:-
when an instance method declaration includes the modifier abstract,the method is said to be an abstract method.
Some characteristics of abstract method are:-
It can not have implementation.
Its implementation must be provide in
non-abstract derived classes by overriding the
method.
It can be declared only in abstract classes.
It can not take either static or virtual
modifier.
An abstract declaration is permitted to
override a virtual method.
No comments:
Post a Comment