调用其他文件中类的方法,不想包含其头文件
test.h
#include <iostream.h>
class A
{
public:
test(){cout<<"test"<<endl;}
};
#include "stdafx.h"
class A;
int main()
{
A* a= new A();
a->test();
return 0;
}
#include <iostream.h>
#ifndef __ONLY_USE_CALSS_A__
...
#endif
class A
{
public:
test(){cout<<"test"<<endl;}
};
#ifndef __ONLY_USE_CALSS_A__
...
#endif
#include "stdafx.h"
#define __ONLY_USE_CALSS_A__
#include "test.h"
class A;
int main()
{
A* a= new A();
a->test();
return 0;
}