C++ | Bucky freakin Roberts

/ 26 Sept 2013 /
#include <iostream>
#include <string>

using namespace std;

class Birthday
{
 public:
  Birthday(int m, int d, int y) {
   month = m;
   day = d;
   year = y;
  }
  void printDate() {
   cout << month << "/" << day << "/" << year << endl; 
  } 
 private:
  int month;
  int day;
  int year;
};

class People {
 public:
  People(string x, Birthday bo)
  : name(x), date(bo)
  {
   
  }
  void printInfo(){
   cout << name << " was born on ";
   date.printDate();
  }
 private:
  string name;
  Birthday date;
};

int main() {
 Birthday bobj(12, 28, 1986);
 People bucky("Bucky the king", bobj);
 bucky.printInfo();
}
 
Copyright © 2010 M(ath)+me, All rights reserved