Consider the following:
These classes are in different header files and each header file has its corrresponding source files.
//------------------------------------------
// in Z.h
class Z
{
public:
Z();
~Z();
void DoSomethingNasty();
}
//------------------------------------------
// in X.h
class X
{
public:
X();
~X();
void FunctionThatCallsNastyFunctions();
}
//------------------------------------------
// in MainClass.h
#include "Z.h"
#include "X.h"
class MainClass
{
public:
MainClass();
~MainClass();
private:
Z _z;
X _x;
}
And i have X.cpp:
//------------------------------------------
// in X.cpp
X::FunctionThatCallsNastyFunctions()
{
//How can I do this? The compiler gives me error.
_z.DoeSomethingNasty();
}
What should i do in order to call DoSomethingNasty() function from _z object? I can't figure this one out. Please help me.
Zsolt