Abstract class - Abstract class is designed to act as a base class (to be inherited by other classes). Abstract class is a design concept in program development and provides a base upon which other classes are built. Below are some of its feature I) You cannot create a object of abstract class ii) After declaring an abstract class, it cannot be instantiated on its own, it must be inherited. iii) In VB.NET abstract classes are created using “MustInherit” keyword.In C# we have “Abstract” keyword. iv) Abstract classes can have implementation or pure abstract methods which should be implemented in the child class. v) Unlike interface abstract class can also have concrete methods.
Interface - Interface defines the signature of the functionality. So if a class is implementing a interface it says to the outer world, that it provides specific behaviour. Example if a class is implementing Idisposable interface that means it has a functionality to release unmanaged resources. Below are some of its feature i) Single Class can implement multiple interfaces. ii) If a class implements a interface then it has to provide implementation to all its methods. iii) Interface cannot have any concrete method
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment