ecomputernotes's picture
From ecomputernotes rss RSS  subscribe Subscribe

Computer Notes - Hierarchy of Inheritance 

http://ecomputernotes.com - Computer Notes - Hierarchy of Inheritance in Object oriented Programming what is Hierarchy of Inheritance Explain about it in detail .explain it with example

 

 
 
Tags:  Computer  Notes 
Views:  28
Published:  January 02, 2012
 
0
download

Share plick with friends Share
save to favorite
Report Abuse Report Abuse
 
Related Plicks
Computational Aspects of Algebraic Curves (Lecture Notes Series on Computing)

Computational Aspects of Algebraic Curves (Lecture Notes Series on Computing)

From: anon-389007
Views: 222 Comments: 0
Computational Aspects of Algebraic Curves (Lecture Notes Series on Computing) ,romantic ebooks online, top ten library in the world, library and the woodlands texas, items needed in a library
 
Natural language communication with computers (Lecture notes in computer science)

Natural language communication with computers (Lecture notes in computer science)

From: anon-391955
Views: 300 Comments: 0
Natural language communication with computers (Lecture notes in computer science) ,libraries cockeysville, flowers in the attic ebook, the library store tremont il, polk county florida library system
 
Quantum Probability for Probabilists (Lecture Notes in Mathematics)

Quantum Probability for Probabilists (Lecture Notes in Mathematics)

From: anon-390802
Views: 220 Comments: 0
Quantum Probability for Probabilists (Lecture Notes in Mathematics) ,error correcting coding ebook, computer ebook free programming, public library lookup, user services in libraries
 
Efficient Visual Recognition Using the Hausdorff Distance (Lecture Notes in Computer Science)

Efficient Visual Recognition Using the Hausdorff Distance (Lecture Notes in Computer Science)

From: anon-389753
Views: 304 Comments: 0
Efficient Visual Recognition Using the Hausdorff Distance (Lecture Notes in Computer Science) ,ala shatford library, library jobs 77084, motive client utility library, where to download panelw library ubuntu
 
Computer Algebra Methods for Equivariant Dynamical Systems (Lecture Notes in Mathematics)

Computer Algebra Methods for Equivariant Dynamical Systems (Lecture Notes in Mathematics)

From: anon-391693
Views: 296 Comments: 0
Computer Algebra Methods for Equivariant Dynamical Systems (Lecture Notes in Mathematics) ,public library reference service articles, volunteer library, difference between libraries and playlists itunes, rangeview library system
 
Formal Syntax and Semantics of Java (Lecture Notes in Computer Science)

Formal Syntax and Semantics of Java (Lecture Notes in Computer Science)

From: anon-390958
Views: 367 Comments: 0
Formal Syntax and Semantics of Java (Lecture Notes in Computer Science) ,8085 free ebooks, public library brea, fingerprint database and library, library forrest illinois
 
See all 
 
More from this user
Computer Notes - Member Templates

Computer Notes - Member Templates

From: ecomputernotes
Views: 13
Comments: 0

Computer Notes - Information Hiding(OOP)

Computer Notes - Information Hiding(OOP)

From: ecomputernotes
Views: 29
Comments: 0

Computer Notes - Inheritance

Computer Notes - Inheritance

From: ecomputernotes
Views: 31
Comments: 0

Computer Notes - Member Templates II

Computer Notes - Member Templates II

From: ecomputernotes
Views: 19
Comments: 0

Computer Notes - Iterators

Computer Notes - Iterators

From: ecomputernotes
Views: 29
Comments: 0

Computer Notes - Inheritance in Class

Computer Notes - Inheritance in Class

From: ecomputernotes
Views: 16
Comments: 0

See all 
 
 
 URL:          AddThis Social Bookmark Button
Embed Thin Player: (fits in most blogs)
Embed Full Player :
 
 

Name

Email (will NOT be shown to other users)

 

 
 
Comments: (watch)
 
 
Notes:
 
Slide 1: Hierarchy of Inheritance http://ecomputernotes.com
Slide 2: Hierarchy of Inheritance • We represent the classes involved in inheritance relation in tree like hierarchy http://ecomputernotes.com
Slide 3: Example GrandParent Parent1 Parent2 Child1 Child2 http://ecomputernotes.com
Slide 4: Direct Base Class • A direct base class is explicitly listed in a derived class's header with a colon (:) class Child1:public Parent1 http://ecomputernotes.com
Slide 5: Indirect Base Class • An indirect base class is not explicitly listed in a derived class's header with a colon (:) • It is inherited from two or more levels up the hierarchy of inheritance class GrandParent{}; class Parent1: public GrandParent {}; class Child1:public Parent1{}; http://ecomputernotes.com
Slide 6: Base Initialization • The child can only perform the initialization of direct base class through base class initialization list • The child can not perform the initialization of an indirect base class through base class initialization list http://ecomputernotes.com
Slide 7: Example class GrandParent{ int gpData; public: GrandParent() : gpData(0){...} GrandParent(int i) : gpData(i){...} void Print() const; };
Slide 8: Example class Parent1: public GrandParent{ int pData; public: Parent1() : GrandParent(), pData(0) {…} }; http://ecomputernotes.com
Slide 9: Example class Child1 : public Parent1 { public: Child1() : Parent1() {...} Child1(int i) : GrandParent (i) //Error {...} void Print() const; };
Slide 10: Overriding • Child class can override the function of GrandParent class http://ecomputernotes.com
Slide 11: Example GrandParent Print() Parent1 Child1 Print() http://ecomputernotes.com
Slide 12: Example void GrandParent::Print() { cout << “GrandParent::Print” << endl; } void Child1::Print() { cout << “Child1::Print” << endl; } http://ecomputernotes.com
Slide 13: Example int main(){ Child1 obj; obj.Print(); obj.Parent1::Print(); obj.GrandParent::Print(); return 0; } http://ecomputernotes.com
Slide 14: Output • Output is as follows Child1::Print GrandParent::Print GrandParent::Print http://ecomputernotes.com
Slide 15: Types of Inheritance • There are three types of inheritance -Public -Protected -Private • Use keyword public, private or protected to specify the type of inheritance http://ecomputernotes.com
Slide 16: Public Inheritance class Child: public Parent {…}; Member access in Base Class Public Protected Private Derived Class Public Protected Hidden
Slide 17: Protected Inheritance class Child: protected Parent {…}; Member access in Base Class Public Protected Private Derived Class Protected Protected Hidden
Slide 18: Private Inheritance class Child: private Parent {…}; Member access in Base Class Public Protected Private Derived Class Private Private Hidden
Slide 19: Private Inheritance • If the user does not specifies the type of inheritance then the default type is private inheritance class Child: private Parent {…} is equivalent to class Child: Parent {…} http://ecomputernotes.com
Slide 20: Private Inheritance • We use private inheritance when we want to reuse code of some class • Private Inheritance is used to model “Implemented in terms of” relationship http://ecomputernotes.com
Slide 21: Example class Collection { public: void AddElement(int); bool SearchElement(int); bool SearchElementAgain(int); bool DeleteElement(int); }; http://ecomputernotes.com
Slide 22: Example • If element is not found in the Collection the function SearchElement will return false • SearchElementAgain finds the second instance of element in the collection http://ecomputernotes.com
Slide 23: Class Set class Set: private Collection { private: public: void AddMember(int); bool IsMember(int); bool DeleteMember(int); }; http://ecomputernotes.com
Slide 24: Class Set void Set::AddMember(int i){ if (! IsMember(i) ) AddElement(i); } bool Set::IsMember(int i){ return SearchElement(i); } http://ecomputernotes.com

   
Time on Slide Time on Plick
Slides per Visit Slide Views Views by Location