0% found this document useful (0 votes)
4 views

Inheritance c#

Uploaded by

fmugheri83
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Inheritance c#

Uploaded by

fmugheri83
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7

INHERITANCE IN C#

INHERITANCE IN C#

This presentation will explain what is


inheritance why it matters, and provide an
example to help you understand.
WHAT IS INHERITANCE?

Definition: Inheritance in C# means a child class can share and use


the functions and properties of a parent class. This makes it easier
to reuse code and keep programs organized
WHAT IS INHERITANCE?

Definition: Inheritance in C# means a child class can share and use


the functions and properties of a parent class. This makes it easier
to reuse code and keep programs organized

Key Points:
• Helps organize classes in a structured way, like family tree.
• Avoid repetitive code
• Base class: the main class with common features
• Derived class: the new class that adds or changes features from the base
INHERITANCE EXAMPLE

Base Class

ANIMAL
• String Name;
• Int Age;
• Void Eat() {};
• Void Sleep() {};
INHERITANCE EXAMPLE
Base Class

ANIMAL
• String Name;
• Int Age;
• Void Eat() {};
• Void Sleep() {};

Derived Class Derived Class

Dog Bird
Inherit 'Animal ' Inherit 'Animal '
• String Name; into Dog class into bird class • String Name;
• Int Age; • Int Age;
• Void Eat() {}; • Void Eat() {};
• Void Sleep() {}; • Void Sleep() {};
• Void Walk() {}; • Void Walk() {};
• Void Fly() {};
THANK YOU...

The End of Topic

You might also like