How to get instance of class from Class in External file?

  • Thread starter Thread starter Khanh01
  • Start date Start date
K

Khanh01

Guest
Hello, suppose I have the following 3 files, I want to declare a variable instance of MyContextReactor class in call.cpp

MyClass.cpp


#include "function.h"

class MyContextReactor : public AcEdInputContextReactor
{
public:
void
beginGetPoint(
const AcGePoint3d* pointIn,
const char* promptString,
int initGetFlags,
const char* pKeywords);

....

private:

....

}

//my function

MyContextReactor::beginGetPoint...

...


Call.cpp


#include "function.h"

MyContextReactor cls;


my questions is:

in function.h file

do I have to declare all the function and variables of function.h again? (If so, I have to copy it twice?)

function.h


#ifdef...

...

#endif

class MyContextReactor : public AcEdInputContextReactor
{
public:
void
beginGetPoint(
const AcGePoint3d* pointIn,
const char* promptString,
int initGetFlags,
const char* pKeywords);

...

};


Is there any shorter method? please help me.
thanks a lot!

Continue reading...
 
Back
Top