Your SlideShare is downloading. ×
0
C Sharp Jn (6)
C Sharp Jn (6)
C Sharp Jn (6)
C Sharp Jn (6)
C Sharp Jn (6)
C Sharp Jn (6)
C Sharp Jn (6)
C Sharp Jn (6)
C Sharp Jn (6)
C Sharp Jn (6)
C Sharp Jn (6)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

C Sharp Jn (6)

340

Published on

Published in: Automotive, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
340
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

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

×