

Inheritance -OOP
Presentation
•
Information Technology (IT)
•
•
Practice Problem
•
Hard
Prosper Yeng
FREE Resource
10 Slides • 0 Questions
1
INT201: Object-Oriented Programming – Inheritance (C#)
By Dr. Prosper Yeng
2
Learning Objectives (Aligned with Bloom’s Taxonomy).By the end of this lesson, students will be able to:
Revise on the concepts of object, and class
Define inheritance in object-oriented programming.
Explain how inheritance enables code reusability and hierarchical class relationships.
Demonstrate single and multilevel inheritance in C# through practical code examples (e.g., Car → ElectricCar)
Differentiate between various types of inheritance
3
1. What Is an Object?
An object is a real-world entity that has data (attributes) and behavior (methods).
Example: A Car object has:
brand = Toyota
color = red
speed = 120
Methods: Start(), Stop()
Objects are created from templates or blueprints called classes.
4
2. What Is a Class?
A class is a blueprint that defines what data and actions its objects can have.
Example:
public class Car {
public string brand;
public int speed;
public void Start() {
Console.WriteLine("Car started");
}
public void Stop() {
Console.WriteLine("Car stopped");
}
}
5
3. Creating an Object instance from a Class
Example:
Car myCar = new Car();
myCar.brand = "Toyota";
myCar.speed = 120;
myCar.Start();
Output:
Car started
6
Inheritance is an object-oriented programming (OOP) principle
Allows a new class (called the child or derived class)
To acquire the properties and behaviors of an existing class (called the parent or base class).
Example: ElectricCar inherits all properties from Car and adds new ones like ChargeBattery().
4. What Is Inheritance?
7
5. Example: Car → ElectricCar
public class Car {
public string brand;
public void Start()
{
Console.WriteLine("Car started");
}
}
public class ElectricCar : Car {
public int batteryLevel;
public void ChargeBattery()
{
Console.WriteLine("Battery charging...");
batteryLevel = 100;
}
}
8
6. Using the ElectricCar Class
ElectricCar myTesla = new ElectricCar();
myTesla.brand = "Tesla";
myTesla.Start(); // from Car
myTesla.ChargeBattery(); // from ElectricCar
Output:
Car started
Battery charging...
9
7. Calling Parent Method Using base
10
8.Recap
Object – real-world entity
Class – blueprint for objects
Inheritance – child uses parent’s code
Inheritance types
Next class:
base – calls parent method
override – modifies parent behavior
Inheritance type implementation
INT201: Object-Oriented Programming – Inheritance (C#)
By Dr. Prosper Yeng
Show answer
Auto Play
Slide 1 / 10
SLIDE
Similar Resources on Wayground
9 questions
Common Grammar Mistakes
Presentation
•
6th Grade
6 questions
7 Procesorul
Presentation
•
5th - 9th Grade
9 questions
Cohesive devices lesson 1
Presentation
•
8th Grade
7 questions
Unit 5, Day 4
Presentation
•
10th Grade
9 questions
Figurative Language: Metaphors
Presentation
•
5th - 6th Grade
10 questions
Summary
Presentation
•
7th Grade
7 questions
Colons & Semicolons
Presentation
•
9th - 10th Grade
9 questions
parts of speech
Presentation
•
6th - 8th Grade
Popular Resources on Wayground
6 questions
Secondary Safety Quiz
Presentation
•
9th - 12th Grade
10 questions
Afterschool Activities & Sports
Quiz
•
6th - 8th Grade
19 questions
ROAR Week 2026
Quiz
•
9th - 12th Grade
20 questions
Lab Safety Quiz
Quiz
•
6th Grade
15 questions
Cool Tool:Chromebook
Quiz
•
6th - 8th Grade
22 questions
would you rather
Quiz
•
3rd - 11th Grade
21 questions
Continents and Oceans
Quiz
•
6th Grade
20 questions
Parts of Speech
Quiz
•
5th Grade
Discover more resources for Information Technology (IT)
20 questions
Place Value
Quiz
•
KG - 3rd Grade
6 questions
We don't eat our CLASSMATES
Quiz
•
KG
88 questions
FMS - Math Facts
Quiz
•
KG - 8th Grade
12 questions
Name that Candy
Quiz
•
KG - 12th Grade
10 questions
Would you rather...
Quiz
•
KG - University
10 questions
Place Value: Hundreds, Tens, and Ones
Quiz
•
KG - 2nd Grade
10 questions
NOUN
Quiz
•
KG
11 questions
Colors in Spanish - Los Colores
Quiz
•
KG - 2nd Grade