Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
C++ call class from a class
so, i have this source, i've set up the friends but it's not working:
{
friend class sys;
private:
string input;
void handle(string input)
{
if (input == "help")
{
//condition block
}
if (input == "cls")
{
sys::clear(); //trying to call the clear function in the class sys
command();
}
if (input == "ls" && sbinactive) //working with sbin() function;
{
}
else
{
command();
}
}
public:
void command()
{
cout << "[root@localhost /sbin]# ";
getline(cin, input);
handle(input);
}
};
class sys
{
friend class commands;
private:
public:
void pause()
{
cout << "Press ENTER to continue ... ";
cin.get();
}
void clear()
{
system("cls");
}
void endline()
{
cout << "\n";
}
void initialize()
{
//inicializace vectoru se soubory pro sbin
//plnim vector daty
sbin(); //volam fci sbin();
}
};
commands com1;
sys sys1;```
the calling is still not working. what is wrong? thanks.