Hi
For example i have .h and .cpp file that define my class like that:
Code:
//a.h
class CExample {
public:
int a,b,c;
CExample (int n, int m);
void multiply() ;
};
and
Code:
//a.cpp
#include "a.h"
CExample::CExample (int n, int m) { a=n; b=m; };
void CExample::multiply () { c=a*b; };
I want to use Cexample class object in another .cpp file without include a.h in the same project
Like that:
Code:
//main.cpp
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
extern CExample c(5,4); //gives error.
return 0;
}
It gives error.
Is there a way to use an object in another .cpp file (in the same project) without include its header file in c++?
I tried extern CExample c(5,4);
but doesnt work
Thanks