class Menu {
public:
void welcome() {
std::cout << "HELLO " << name << std::endl; //name of hero printed
}
}
class Hero {
private:
std::string name;
Menu menu;
public:
void getName() {
return name;
}
void welcomeFromHero() {
menu.welcome() // i know i can pass here name to function but there are multiple values, can i pass the whole hero object?
}
}
class Menu {
public:
void welcome() {
std::cout << "HELLO " << name << std::endl; //name of hero printed
}
}
class Hero {
private:
std::string name;
Menu menu;
public:
void getName() {
return name;
}
void welcomeFromHero() {
menu.welcome(*this) // i know i can pass here name to function but there are multiple values, can i pass the whole hero object?
}
}
void welcome(string &s);
...
menu.welcome(name);
menu does not need the whole class in this scenario. If it needs all of it for something else, disregard.