Hi all,
i am having problem by instantiating an object of class in the same source file.
say, we have this code :
// file.h
#ifndef A
#define A
class A{
A();
~A();
// member functions
A_foo();
};
#endif;
// file.cpp
#include file.h
A Obj; // here is the cause of error
void A_foo(){
// something
}
when i execute the program i get segmentation error. If i increment the instance Obj . the program can be executed somehow!!
How can i declare this Obj of the same class file?
may someone help me with any suggestion?
i am having problem by instantiating an object of class in the same source file.
say, we have this code :
// file.h
#ifndef A
#define A
class A{
A();
~A();
// member functions
A_foo();
};
#endif;
// file.cpp
#include file.h
A Obj; // here is the cause of error
void A_foo(){
// something
}
when i execute the program i get segmentation error. If i increment the instance Obj . the program can be executed somehow!!
How can i declare this Obj of the same class file?
may someone help me with any suggestion?
Comment