Fixing constructor/destructor in C++?
I am currently unable to run my code without my destructors destroying everything while run and I was unsure of how to fix this-- what am I doing and how can I fix my code?
class noun // struct to class inheritance words/noun word/code
{
private:
string word;
string description;
int code;
int location;
bool can_carry;
public:
noun(string word, string desc, int code, int location, bool can_carry) {}
noun() : word(), description(), code(), location(), can_carry() {}
noun(int my_location) : location(my_location) {}
~noun()
{
//cout << "Destructing noun: " << word << " with description: " << description << " with code: " << code << " with location: " << location << endl;
}
//getter use inheritance for getter and setter to word
string get_word()
{
return word;
}
// setter
void set_word(string my_word)
{
word = my_word;
}
//getter use inheritance for getter and setter to word
string get_desc()
{
return description;
}
//setter
void set_desc(string _description)
{
description = _description;
}
// getter use inheritance for getter and setter to word
int get_code()
{
return code;
}
// setter
void set_code(int my_code)
{
code = my_code;
}
// getter use inheritance for getter and setter to word
int get_location()
{
return location;
}
// setter
void set_location(int my_location)
{
location = my_location;
}
bool get_can_carry()
{
return can_carry;
}
void set_can_carry(bool my_can_carry)
{
can_carry = my_can_carry;
}
};