SlideShare a Scribd company logo
Software Development  Training Program Zeeshan Hanif
DotNet 3.5-101 Lecture 7 Zeeshan Hanif [email_address] [email_address]
Inheritance What is Inheritance Inherited Members new method virtual and override methods Polymorphism Abstract classes Sealed classes Object class Boxing and Unboxing Interfaces
Inheritance Inheritance is a powerful mechanism that allows a class to inherit functionality from an existing class.  For example, Cat, Dog, both are  kinds of Mammal.  Car and Bus both are kinds of Vehicle
is-a Relationship The is-a relationship is one of specialization. When we say, Dog is-a mammal, means dog is specialized kind of mammal Mammal is generalization kind of Dog
Car Luxury cars Sports Car
Inheritance In object-oriented terminology, sports cars and luxury cars are  derivedclasses  of car class. Similarly, the car class is the  baseclass  of luxury car and sports car.
Example public class Car { public int wheels; public string color; } public class SportsCar  : Car  { public int noOfSeats; }
Inheritance Each derived class  inherits  all variables from the base class. Sports cars and luxury cars both inherits four wheels, gears etc.  Also, each derived class inherits methods from the base class. Luxury cars and sports cars share some behaviors: braking and changing speed, for example.
Inheritance A However, derived classes are not limited to the state and behaviors provided to them by their base class. Derived classes can add more variables and methods. Sports cars have two seats and, some sports cars have an extra set of gears.
Inheritance What is Inheritance Inherited Members new method virtual and override methods Polymorphism Abstract classes Sealed classes Object class Boxing and Unboxing Interfaces

More Related Content

PPT
C Sharp Jn (1)
PPT
C Sharp Jn (3)
PPT
C Sharp Jn (2)
PPT
C Sharp Jn
PPT
C Sharp Jn (5)
PPT
C Sharp Jn (5)
PPTX
DOCILITY (IMPRONTA) FULL
PDF
The Six Highest Performing B2B Blog Post Formats
C Sharp Jn (1)
C Sharp Jn (3)
C Sharp Jn (2)
C Sharp Jn
C Sharp Jn (5)
C Sharp Jn (5)
DOCILITY (IMPRONTA) FULL
The Six Highest Performing B2B Blog Post Formats

Similar to C Sharp Jn (6) (20)

PDF
Inheritance interested in codingggggggggggggggggggg
PDF
C++ L10-Inheritance
PPT
Chapter 08
PPTX
Lecture 4 inheritance , polymorphism.pptx
PDF
Object oriented programming inheritance
PDF
Inheritance and Substitution
PDF
(5) c sharp introduction_object_orientation_part_ii
PDF
2 BytesC++ course_2014_c11_ inheritance
PDF
Xamarin: Inheritance and Polymorphism
PPTX
Ritik (inheritance.cpp)
PPTX
Inheritance
PDF
Inheritance - the myth of code reuse | Andrei Raifura | CodeWay 2015
PDF
All about python Inheritance.python codingdf
PPTX
Lecture 3
PPT
Ap Power Point Chpt7
PDF
INHERITANCE
PPT
Inheritance
PDF
L9
PPTX
java_inheritance_oop_20250730110153.pptx
PPTX
Object Oriented Programming
Inheritance interested in codingggggggggggggggggggg
C++ L10-Inheritance
Chapter 08
Lecture 4 inheritance , polymorphism.pptx
Object oriented programming inheritance
Inheritance and Substitution
(5) c sharp introduction_object_orientation_part_ii
2 BytesC++ course_2014_c11_ inheritance
Xamarin: Inheritance and Polymorphism
Ritik (inheritance.cpp)
Inheritance
Inheritance - the myth of code reuse | Andrei Raifura | CodeWay 2015
All about python Inheritance.python codingdf
Lecture 3
Ap Power Point Chpt7
INHERITANCE
Inheritance
L9
java_inheritance_oop_20250730110153.pptx
Object Oriented Programming
Ad

Recently uploaded (20)

PPTX
Quarter-1-Lesson-5-sdf wgwefwgwefgwgwgwewgwewgwewwedgfwrwtudents-copy.pptx
PDF
book-slidefsdljflsk fdslkfjslf sflgs.pdf
PDF
Governor Volvo EC55 Service Repair Manual.pdf
PPTX
Training Material_Verification Station.pptx
PDF
Cylinder head Volvo EC55 Service Repair Manual.pdf
PDF
Life Cycle Analysis of Electric and Internal Combustion Engine Vehicles
PPTX
Constitutional Design PPT.pptxl from social science class IX
PPT
IOT UNIT –II-IT ppt (1).pptsssssddfdfdffdfd
PPTX
Moral Theology (PREhhhhhhhhhhhhhhhhhhhhhLIMS) (1).pptx
PPTX
internal combustion engine renewable new
PPTX
IOT-UNIT 3.pptxaaaasasasasasasaasasasasas
PDF
Articulated Dump Truck John Deere 370E 410E 460E Technical Manual.pdf
PDF
Pharmacy is a goood college yvucc7t7tvy7tv7t
PDF
GMPL auto injector molding toollllllllllllllll
PDF
Engine Volvo EC55 Compact Excavator Service Repair Manual.pdf
PDF
John Deere 410E II Articulated Dump Truck Service Manual.pdf
PDF
Dongguan Sunnew ESS Profile for the year of 2023
PDF
Volvo EC55 Compact Excavator Service Repair Manual Instant Download.pdf
PDF
Transmission John Deere 370E 410E 460E Technical Manual.pdf
PPT
Main/Core Business Application User Manual
Quarter-1-Lesson-5-sdf wgwefwgwefgwgwgwewgwewgwewwedgfwrwtudents-copy.pptx
book-slidefsdljflsk fdslkfjslf sflgs.pdf
Governor Volvo EC55 Service Repair Manual.pdf
Training Material_Verification Station.pptx
Cylinder head Volvo EC55 Service Repair Manual.pdf
Life Cycle Analysis of Electric and Internal Combustion Engine Vehicles
Constitutional Design PPT.pptxl from social science class IX
IOT UNIT –II-IT ppt (1).pptsssssddfdfdffdfd
Moral Theology (PREhhhhhhhhhhhhhhhhhhhhhLIMS) (1).pptx
internal combustion engine renewable new
IOT-UNIT 3.pptxaaaasasasasasasaasasasasas
Articulated Dump Truck John Deere 370E 410E 460E Technical Manual.pdf
Pharmacy is a goood college yvucc7t7tvy7tv7t
GMPL auto injector molding toollllllllllllllll
Engine Volvo EC55 Compact Excavator Service Repair Manual.pdf
John Deere 410E II Articulated Dump Truck Service Manual.pdf
Dongguan Sunnew ESS Profile for the year of 2023
Volvo EC55 Compact Excavator Service Repair Manual Instant Download.pdf
Transmission John Deere 370E 410E 460E Technical Manual.pdf
Main/Core Business Application User Manual
Ad

C Sharp Jn (6)

  • 1. Software Development Training Program Zeeshan Hanif
  • 2. DotNet 3.5-101 Lecture 7 Zeeshan Hanif [email_address] [email_address]
  • 3. Inheritance What is Inheritance Inherited Members new method virtual and override methods Polymorphism Abstract classes Sealed classes Object class Boxing and Unboxing Interfaces
  • 4. Inheritance Inheritance is a powerful mechanism that allows a class to inherit functionality from an existing class. For example, Cat, Dog, both are kinds of Mammal. Car and Bus both are kinds of Vehicle
  • 5. is-a Relationship The is-a relationship is one of specialization. When we say, Dog is-a mammal, means dog is specialized kind of mammal Mammal is generalization kind of Dog
  • 6. Car Luxury cars Sports Car
  • 7. Inheritance In object-oriented terminology, sports cars and luxury cars are derivedclasses of car class. Similarly, the car class is the baseclass of luxury car and sports car.
  • 8. Example public class Car { public int wheels; public string color; } public class SportsCar : Car { public int noOfSeats; }
  • 9. Inheritance Each derived class inherits all variables from the base class. Sports cars and luxury cars both inherits four wheels, gears etc. Also, each derived class inherits methods from the base class. Luxury cars and sports cars share some behaviors: braking and changing speed, for example.
  • 10. Inheritance A However, derived classes are not limited to the state and behaviors provided to them by their base class. Derived classes can add more variables and methods. Sports cars have two seats and, some sports cars have an extra set of gears.
  • 11. Inheritance What is Inheritance Inherited Members new method virtual and override methods Polymorphism Abstract classes Sealed classes Object class Boxing and Unboxing Interfaces