I am currently learning c++. while doing an example I encountered this error. I don't understand what am I doing wrong here.
using namespace std;
people::people(string n, birthday obj3)
: name(n), obj2(obj3)
cout << name << "was born on " << obj2.PrintDate() << endl; // error line
I assume that your "
PrintDate" function is a function that prints the date inside its definition.
void means that the expression
obj2.PrintDate() does not represent any valid value and therefore you should call the function somewhere beside
cout << line.