Почему возникает следующая ошибка?
определение неявно объявленного 'Clothing::Clothing()
Контекст:
В качестве задания мне нужно выполнить конструкторы, деструкторы и методы в классе Clothing. У меня возникла проблема при попытке определить конструктор в clothing.cpp. Я читал, что проблема в том, что я не объявил конструктор в clothing.h, но думаю, как я это сделал, так он и объявлен. Я понятия не имею, в чем проблема.
Мой код:
clothing.h:
Код: Выделить всё
#ifndef CLOTHING_H_
#define CLOTHING_H_
#include
#include
using namespace std;
class Clothing {
private:
int gender;
int size;
string name;
public:
Clothing();
Clothing(const Clothing &t);
Clothing(int gender, int size, string name);
~Clothing();
int getGender();
int getSize();
string getName();
void setGender(int gender1);
void setSize(int size1);
void setName(string name1);
void print();
void toString();
};
#endif /* CLOTHING_H_ */
Код: Выделить всё
#include
#include "clothing.h"
#include
#include
using namespace std;
Clothing::Clothing() :
gender(1),
size(1),
name("outofstock") {
}
Clothing::Clothing(const Clothing& t) :
gender(t.gender),
size(t.size),
name(t.name) {
}
Clothing::Clothing(int gender, int size, string name) {
}
int Clothing::getGender() {
return gender;
}
int Clothing::getSize() {
return size;
}
string Clothing::getName() {
return name;
}
void Clothing::setGender(int gender1) {
gender = gender1;
}
void Clothing::setSize(int size1) {
size = size1;
}
void Clothing::setName(string name1) {
name = name1;
}
void Clothing::print() {
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/55082238/i-dont-understand-error-definition-of-implicity-declared-clothingclothing[/url]
Мобильная версия