Class - Exercise Error

Hey been practicing exercises on online IDE called Repl.it

I keep getting errors and don’t know what it is from or how to solve.

Here is my link to the class: https://repl.it/@codecaine1/Exercise-1
A couple of changes.

people.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#pragma once 
#include <string>
class People
{
  public:
  People(std::string n, Birthday obj);
  
  void printInfo();
  
  private:
  std::string name;
  Birthday dob;
  
};

Points to note.
1. Assuming that various header files have already been included will mess you about. It's best to make each file self-contained by including what it specifically needs.
2. Being a header file, you don't want to use using namespace std;. So write string in it's fully qualified form as std::string.

people.cpp
1
2
3
4
5
6
7
void People::printInfo()
{
  cout << name << "was born on ";
  dob.printDate();
  cout << endl;
  
}

Your dob.printDate() doesn't return an ostream reference, so it can't be used as
 
  cout << name << "was born on " << dob.printDate() << endl;
Topic archived. No new replies allowed.