2nd Feb 2019, 10:07 AM
BlackGuy
BlackGuy - avatar
2 ответов
+ 1
//Edited two error #include <iostream> using namespace std; class BirthDay { public: BirthDay(int m, int d, int y) : month(m), day(d), year(y) { } void printDate() { cout << "Date of birth: " << month << "/" << day << "/" << year; } private: int month; int day; int year; }; class Person { public: Person(string n, BirthDay b) : name(n) , bd(b) { } void printInfo() { cout << "Name is: " << name << endl; bd.printDate(); } private: string name;// missed a semi colon BirthDay bd; }; int main() { BirthDay bd(5, 2, 1982); Person p("Alex" , bd); p.printInfo(); //bd doesnt have print info person has }
2nd Feb 2019, 10:24 AM
Akib
Akib - avatar
+ 1
Thanks a lot
2nd Feb 2019, 10:30 AM
BlackGuy
BlackGuy - avatar