![]() |
VC++ pointer objects |
Post Reply
|
| Author | |
Nirusoft
Newbie
Joined: 25 August 2005 Status: Offline Points: 6 |
Post Options
Thanks(0)
Quote Reply
Topic: VC++ pointer objectsPosted: 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
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 25 August 2005 at 2:01pm |
|
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 |
Post Options
Thanks(0)
Quote Reply
Posted: 26 August 2005 at 5:08am |
|
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
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 26 August 2005 at 12:46pm |
|
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 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 August 2005 at 2:28am |
|
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
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 August 2005 at 11:11am |
|
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 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 August 2005 at 11:26am |
|
Thanq very much for ur help
|
|
![]() |
|
jhorigan
Newbie
Joined: 27 August 2005 Location: United States Status: Offline Points: 1 |
Post Options
Thanks(0)
Quote Reply
Posted: 27 August 2005 at 11:15pm |
|
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 |