ZH
struct Z {
Z();
~Z();
void DoSomethingNasty();
}
Xh
struct X {
X();
~X();
void FunctionThatCallsNastyFunctions();
}
主类.h
#include "Z.h"
#include "X.h"
struct MainClass {
MainClass();
~MainClass();
private:
Z _z;
X _x;
}
X.cpp
X::FunctionThatCallsNastyFunctions() {
//How can I do this? The compiler gives me error.
_z.DoSomethingNasty();
}
我应该怎么做才能DoSomethingNasty()
从_z
对象调用函数?