C ++ Kein Standardkonstruktor gibt es für die Klasse [Duplikat]C++

Programme in C++. Entwicklerforum
Guest
 C ++ Kein Standardkonstruktor gibt es für die Klasse [Duplikat]

Post by Guest »

Ich habe das folgende Problem konfrontiert: Als ich eine untergeordnete Klasse definierte und den Konstruktor für ihn schrieb, zeigte Visual Studio den "Standardkonstruktor existiert für die Klasse" Person "in der Fehlerliste. Hier ist der Code:

Code: Select all

#include 
#include 

class Person {
protected:
std::string name;
int age;
public:
Person(std::string name, int age) {
this->name = name;
this->age = age;
}
std::string getName() {
return this->name;
}
int getAge() {
return this->age;
}
void celebrateBirthday() {
this->age += 1;
}
};

class Employee : public Person {
private:
int income;
public:
Employee(std::string name, int age, int income) {
this->name = name;
this->age = age;
this->income = income;
}
int getIncome() {
return this->income;
}
};

int main() {

}
Hilf mir bitte!

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post