How to access object of a class declared in one file from another file?
-
Hi Friends I have developed an application(MFC based ) in which first I have my object of one class say objMyClass in one file called File1.h and I have used it in File1.cpp. NOw I want to used the same object(I don't want to create new object) in my another file say File2.h and File2.cpp....how to do that ? Any clue ? Thankx a lot Mahesh
-
Hi Friends I have developed an application(MFC based ) in which first I have my object of one class say objMyClass in one file called File1.h and I have used it in File1.cpp. NOw I want to used the same object(I don't want to create new object) in my another file say File2.h and File2.cpp....how to do that ? Any clue ? Thankx a lot Mahesh
Use
extern
Jesus Loves
--Owner Drawn --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord
-
Use
extern
Jesus Loves
--Owner Drawn --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord
Is it possible to use extern for Objects also. I know we can use it for variables but not sure for object. Also what I want mainly is I don't want to create new objects I just want to use that same object in it's present state. And last but not the least, Thankx a lot for answering my question and taking time for it. Regards Mahesh
-
Is it possible to use extern for Objects also. I know we can use it for variables but not sure for object. Also what I want mainly is I don't want to create new objects I just want to use that same object in it's present state. And last but not the least, Thankx a lot for answering my question and taking time for it. Regards Mahesh
Yeah mahesh
extern
can be used on objects too.Jesus Loves
--Owner Drawn --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord
-
Is it possible to use extern for Objects also. I know we can use it for variables but not sure for object. Also what I want mainly is I don't want to create new objects I just want to use that same object in it's present state. And last but not the least, Thankx a lot for answering my question and taking time for it. Regards Mahesh
even u can extern with function.As function r global by default unless u have not put static with function declaration never say die