Here is the code first:

People.cpp

#include "People.h"
#include "Birthday.h"
#include<string>
#include<iostream>
using namespace std;


People::People(string x, Birthday bo)
: name(x), birth(bo)
{
}

void People::People()
{
    cout << name << "was born on" << birth.printDate();
}

People.h

#ifndef PEOPLE_H
#define PEOPLE_H
#include<string>
#include "Birthday.h"
class People
{
    public:
        People(string x, Birthday bo);
        void printInfo();
    private:

        string name;
        Birthday birth;
};

#endif // PEOPLE_H

The problem is I get these errors when compling the code:

Compiling: src/People.cpp
In file included from /home/deofamily/Documents/Project/src/People.cpp:1:0:
/home/deofamily/Documents/Project/include/People.h:8:23: error: expected ‘)’ before ‘x’
/home/deofamily/Documents/Project/include/People.h:12:9: error: ‘string’ does not name a type
/home/deofamily/Documents/Project/src/People.cpp:6:15: error: expected constructor, destructor, or type conversion before ‘(’ token
/home/deofamily/Documents/Project/src/People.cpp:11:21: error: return type specification for constructor invalid
/home/deofamily/Documents/Project/src/People.cpp:11:21: error: definition of implicitly-declared ‘People::People()’

What am I doing wrong?

People class doesn't have a declaration for the default constructor, String needs to be defined through its namespace.

std::string X. And std::name because you do not have "using namespace std;"

In the people class under the public inheritance, add:

People();

And finally, PrintInfo has no definition.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.