Related Topics:-
OOPs Concepts
What is Abstraction
What is Encapsulation
What is Inheritance
Polymorphism in .Net
Difference between Abstraction and Encapsulation
Inheritance:
OOPs Concepts
What is Abstraction
What is Encapsulation
What is Inheritance
Polymorphism in .Net
Difference between Abstraction and Encapsulation
Inheritance:
When a class acquire the property of another class is known as inheritance.
Inheritance is process of object reusability.
For example, A Child acquire property of Parents.
public class ParentClass
{
public ParentClass()
{
Console.WriteLine("Parent Constructor.");
}
public void print()
{
Console.WriteLine("I'm a Parent Class.");
}
}
public class ChildClass : ParentClass
{
public ChildClass()
{
Console.WriteLine("Child Constructor.");
}
public static void Main()
{
ChildClass child = new ChildClass();
child.print();
}
}
Output:
Parent Constructor.
Child Constructor.
I'm a Parent Class.
Related Topics:-
OOPs Concepts
What is Abstraction
What is Encapsulation
What is Inheritance
Polymorphism in .Net
Difference between Abstraction and Encapsulation
Child Constructor.
I'm a Parent Class.
Related Topics:-
OOPs Concepts
What is Abstraction
What is Encapsulation
What is Inheritance
Polymorphism in .Net
Difference between Abstraction and Encapsulation
No comments:
Post a Comment