is-a has-a relationship

kinley (17)
Hello,

Could someone please explain how the is-a and has-a relationships can be implemented in C++. Couldnt find any helpful URL on Google.

Thank you.

Athar (3762)
Inheritance, composition.

Couldnt find any helpful URL on Google.

Really?
http://www.google.de/search?hl=en&q=c%2B%2B+is-a+relationship
Last edited on
Galik (2228)
Here Dog is a Animal and has a name:

1
2
3
4
5
6
7
8
9
10
class Animal
{
	
};

class Dog
: public Animal
{
	std::string name;
};
IceThatJaw (260)
Inheritance = is-a
Topic archived. No new replies allowed.