Stránky: 1
ahoj potřebovala bych prosím poradit, mam konstruktor s parametrem code a tenhle parametr potřebuju nějak použít v tý metodě LoadConfig, nějak to propojit, aby LoadConfig využívalo ten parametr konstruktoru a možná jestli potom použít destruktor na ten parametr, nevím..
class CTrida
{
CTrida(string code);
}
void LoadConfig(string code)
{
language += ".ini";
ifstream ff;
const char* pFilename = language.c_str();
ff.open(pFilename, ios::in);
char buffer[500];
}
Offline
Co takhle?
class CTrida
{
private:
string code;
public:
CTrida(string code) {
this->code = code;
}
string getCode() {
return code;
}
}
void LoadConfig(CTrida t)
{
string code = t.getCode();
language += ".ini";
ifstream ff;
const char* pFilename = language.c_str();
ff.open(pFilename, ios::in);
char buffer[500];
}
Jinak destruktor mít nemusíš - ten se např. používá, pokud tam máš něco dynamicky alokováno - tedy s klíčovým slovem new.
Offline
Stránky: 1