Friday, March 9, 2018

Tutorial 17 What are difference between abstract classes and interfaces ?

Abstract Classes and Interfaces :

Notes :

1. Abstract classes can contain definition of methods but interface cannot have definition for any method.

2. Abstract classes can contain variables but interfaces are only meant for method declaration.

3. Interface can only inherit from interface but abstract class can inherit from interface and abstract class also.

4. A class can inherit from multiple interfaces but cant inherit from multiple class at same time.

5. Abstract classes method definition can have access modifiers whereas its not possible for interfaces.

What is Diamond Problem in Dotnet ?

This is a problem in Dotnet for multiple inheritance when we try to inherit from derived class and the function with same same is present in parent class also and the compiler is unable to identify from which class implementation is to be done.

What is the use of  interface ?

Using Interface we can achieve multi level inheritance in dotnet. Lets see with one example.








No comments:

Post a Comment