• anonymous
what is the concept of inheritance and aggregation in c++?
Computer Science
  • Stacey Warren - Expert
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
  • schrodinger
I got my questions answered at in under 10 minutes. Go to now for free help!
  • oldman
1) Intuitive Understanding if we have a class called A, which is class A{...}; inheritance like this: class B: public A {...}; aggregation like this: class B{ A some_a; }; 2) Concept Firstly, one of aims of Inheritance and Aggregation is to compartmentalize and reuse code, but they still have differences between each others. Inheritance imply a "is-a" or "is-kind-of" relationship between subclass and super class, e.g. Square is kind of Rectagle,so you can design like: class Square: pulic Rectangle{...}; Aggregation imply a "has-a" relationship between two classes, e.g. a group of person is aggregated by many persons, so you can design like: class PersonGroup { PersonList many_many_Person;}; in sum, there are many differences bwtween them, whether in semantics or in implement, i hope that i can help you . if i have some error, please let me kown, thank you. btw, it's better if my poor english won't confuse you.

Looking for something else?

Not the answer you are looking for? Search for more explanations.