0
Can someone help me?
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
}
+ 1
Thanks a lot