is-a has-a relationship

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.

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
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;
};
Inheritance = is-a
Topic archived. No new replies allowed.