C ++ Общие Ошибки Классы Конструкторы

У меня есть два класса и основной. Я следил за всем настолько хорошо, насколько я могу найти, но все еще есть ошибки

Любая помощь в выявлении ошибки будет хорошо принята

Сообщение об ошибке здесь

main.cpp

#include "People.h"#include "Birthday.h"
int main()
{
Birthday birthObject(8, 7, 1987);

birthObject.printDate();

People danielGadd("DanielGadd", birthObject);

danielGadd.printInfo();

return 0;
}

People.h

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

private:
std::string name;
Birthday dateOfBirth;
};

#endif // PEOPLE_H

People.cpp

#include "People.h"#include "Birthday.h"
People::People(std::string x, Birthday b)
: name(x), dateOfBirth(b)
{
}

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

Birthday.h

#ifndef BIRTHDAY_H
#define BIRTHDAY_H
#include <iostream>

class Birthday
{
public:
Birthday(int d, int m, int y);
void printDate();
private:
int day;
int month;
int year;
};

#endif //BIRTHDAY_H

Birthday.cpp

#include "Birthday.h"
Birthday::Birthday(int d, int m, int y)
{
day = d;
month = m;
year = y;
}void Birthday::printDate()
{
std::cout << day << "/" << month << "/" << year << std::endl;
}

-2

Решение

Я использую Virtual Studio 2015. Я нашел решение. Я просто удалил People.exe из папки отладки и снова собрал проект. И это сработало.
Ал; так похожая проблема, я удалил файл и сделал его заново. Вставил тот же код в и это исправило проблему. Не знаю почему

0

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector