Posted on April 18, 2013. Filed under: C++ | Tags: |

C++ composition is almost the same as other object orented languages such as Java — you can use the objects of other classes as the class member of a class. The only c++ feature is you have to use member initializer list in the constructor to initialize the objects class members, whenever you use a class object inside another class.

#include “People.h”
#include “Birthday.h”
using namespace std;

People::People(string x, Birthday bo)
: name(x),


Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: