0
Upcoming SlideShare
×

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.
Standard text messaging rates apply

# Lec 33 - inheritance

59

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• Be the first to comment

• Be the first to like this

Views
Total Views
59
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
3
0
Likes
0
Embeds 0
No embeds

No notes for slide
• Student Book
• Student Book
• Student Book
• Student Book
• Student Book
• Student Book
• Student Book
• Student Book
• ### Transcript

• 1. Chapter: 09 Inheritance Lecture: 33 Date: 10.10.2012
• 2. Class Hierarchies
• 3. Public and Private Inheritanceclass employee //base class{ };class teacher : public employee //publicly-derived{ };class teacher : private employee //privately-derived{ };
• 4. Public and Private Inheritance
• 5. Levels of Inheritance Classes can be derived from classes that are themselves derived.
• 6. Levels of Hierarchies
• 7. Multiple Inheritance A class can be derived from more than one base class
• 8. Multiple Inheritance
• 9. Aggregation: Classes Within Classes Both inheritance and aggregation are class relationships. Inheritance is “kind of” relationship - association. Aggregation is “has a” relationship - association Def. Aggregation - Several things grouped together or considered as a whole.
• 10. Aggregation: Classes Within Classes Both inheritance and aggregation are class relationships. Inheritance is “kind of” relationship - association. Aggregation is “has a” relationship - association Def. Aggregation - Several things grouped together or considered as a whole.
• 11. Aggregation: Classes Within ClassesAggregation may occur when one object is an attribute of another.In other words, one class contains objects of another class.Example:class A { };class B { A objA; //object of class A is an attribute of class B };
• 12. Aggregation: Classes Within Classes
• 13. Aggregation: Classes Within Classes
• 14. Composition: A Stronger Aggregation Composition is a stronger form of aggregation, having all its plus two more  The part may belong to only one whole  The lifetime of the part is the same as the lifetime of the whole While aggregation is a “has a” relationship, composition is a “consists of” relationship.
• 15. Composition: A Stronger Aggregation Composition is a stronger form of aggregation, having all its plus two more  The part may belong to only one whole  The lifetime of the part is the same as the lifetime of the whole While aggregation is a “has a” relationship, composition is a “consists of” relationship.