+ 1
Why we don't use string header file in this snippet
#include <iostream> 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 Person { public: Person(string n, Birthday b) : name(n), bd(b) { } void printInfo() { cout << name << endl; bd
1 Odpowiedź
+ 8
In some compilers, <string> is included in <iostream>. That said, it is a good practice to explicitly include <string> when you need to utilize the string class.