Sunday, March 4, 2018

Tutorial 11 What is Inheritance and How we can use inheritance?

What is Inheritance? 

Inheritance means Inherit something from others. Its one of the pillar of concepts in OOPS. We can define common things inside one class and use it different class.

For E.g. In job search portal we have many tasks. Defining classes for Employee , Employers and Job Search. So we can have part time and full time jobs also. But in Part time and Full time job only pay element is different rest all are same.

What is the advantage?

Reusability of Code :- we can use code defination once and reuse it multiple times.

 What is Syntax?

AccessModifier class classname : class from where we need to inherit

So for reference and more understanding we will check the below screen.

Note : Multiple class inheritance is not possible in dotnet but multi level class inheritance is possible.

But multiple interface inheritance is possible in dotnet C#. What are Interface ? Will tell you?

Instance of base class is automatically created before derived class. You can create multiple constructor and use base keyword to check 


No comments:

Post a Comment