Problem using composition.

The following program shows no output nor it shows any kind of error while compiling. Help me find a solution to it.

#include <iostream>
#include <string>
using namespace std;

class Birthday
{
public:
Birthday(int d, int m, int y)
{
day = d;
month = m;
year = y;
}


void printdate()
{
cout << day << "/" << month << "/" << year << endl;
}

private:
int day;
int month;
int year;
};

class People
{
public:
People(string x, Birthday bo)
:name(x),
dateofbirth(bo)
{

}
void printsomething()
{
cout << name << "birthday is on ";
dateofbirth.printdate();
}



private:
Birthday dateofbirth;
string name;
};




int main()
{
Birthday printbirthday(20,06,1996);
People myself("Surendra",printbirthday );
}
1. Please use code tags when posting code, to make it readable:

http://www.cplusplus.com/articles/z13hAqkS/

2. Your program shows no output, because you're not outputting anything. In your main function, you create 2 objects, and then... do nothing at all with them. You don't call any methods on those objects that would output anything.
thanks a lot. it completely went out of my mind.
Topic archived. No new replies allowed.