![]() |
VC++ pointer objects |
Post Reply ![]() |
Author | |
Nirusoft ![]() Newbie ![]() Joined: 25 August 2005 Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() Posted: 25 August 2005 at 10:08am |
HI
I have some problem in VC++ can any one help in resolving it the follwing is the code class ClassA { ........... } In ClassA.h i wrote void fun1(); void fun2(); in ClassB.h i declared a pointer object to ClassA like the following ClassA *obj; class ClassB { void fun3() { obj=new ClassB(); obj.fun1();// here the error is fun1() must have class/stuct/union type. } } and one more thing when we right click on the class name in the popup menu there will be a option like " go to Definition of <class name>" when we click this it should take to class definition. but instead it is giving me a error message saying " the symbol <class name> is undefined" please kindly help me in this regard u can mail me to the email -id "t_niru82@yahoo.com" also thanks in advance Niranjan |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Move this code to cpp file or and #include ClassA.h" in begining of ClassB.h |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Nirusoft ![]() Newbie ![]() Joined: 25 August 2005 Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
Hi
Thanks for ur suggestion. can u give me the answer for the following also when we right click on the class name in the popup menu there will be a option like " go to Definition of <class name>" when we click this it should take to class definition. but instead it is giving me a error message saying " the symbol <class name> is undefined" niranjan |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
It means, Visual Studio can't find this class, may be you didn't add class.h file to your solution. sometimes ncb file be broken. try to delete it, Visual Studio recreate it after first run. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Nirusoft ![]() Newbie ![]() Joined: 25 August 2005 Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
I have added the class.h header file to my solution. but i'm not understanding "ncb file broken" can you please brief me on this point and also tell me how to delete it.
|
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hello, in the directory find file with ncb extension. Just deelte it. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Nirusoft ![]() Newbie ![]() Joined: 25 August 2005 Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
Thanq very much for ur help
|
|
![]() |
|
jhorigan ![]() Newbie ![]() ![]() Joined: 27 August 2005 Location: United States Status: Offline Points: 1 |
![]() ![]() ![]() ![]() ![]() |
ClassB member obj is a pointer to a ClassA object. You need to use the following code:
obj->fun1() |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |