Ich habe eine zwei Klassen und eine Haupt. Ich habe alles so gut gefolgt, wie ich finden kann, aber immer noch Fehler habenC++ Allgemeine Fehler Klassen Konstrukteurs
Jede Hilfe identifizieren die Fehler würde gut
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
empfangen werden#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;
}
bitte die Fehlermeldungen in der Frage (Klartext, kein Bild) – user463035818
Wenn die Visual Studio kopieren Sie den Text der Fehlermeldung von der Registerkarte Ausgabe umfassen. 'Alt-2' – drescherjm
ist dies ein Copy-Paste-Fehler, oder gibt es eine zweite Erklärung von' Klasse Birthday' in Ihrem Birthday.cpp? – user463035818