classCからclassBのメンバーにアクセスしようとしていますが、classCとclassBはclassAの中にあります。ここに私がやろうとしていることがあります。クラス内で2つのクラスを定義し、そのメンバーにアクセス
//hello.h
class hello{
public:
hello();
class letters{
public:
letters();
void setName(char n);
char getName();
private:
char name;
}
class sayHi{
public:
sayHi();
void onJoin();
}
}
//hello.cpp
hello::hello(){}
hello::letters(){}
hello::sayHi(){}
void hello::letters::setName(char n){
hello::letters::name = n; //trying to access the private variable 'name' inside class letters
}
char hello::letters::getName(){
return hello::letters::name = n;
}
void hello::sayHi::onJoin(){
cout<< hello::letters::getName() <<endl;
}
私は、私は、各クラスのインスタンスを作成し、メンバーを呼び出すことになっています、私はそれが間違ってやっている知っていますか?