A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing


  • 5 years ago

what is the concept of inheritance and aggregation in c++?

  • This Question is Closed
  1. OldMan
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

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

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...


  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.