Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > General Discussion
  New Posts New Posts RSS Feed - VC++ pointer objects
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

VC++ pointer objects

 Post Reply Post Reply
Author
Message
Nirusoft View Drop Down
Newbie
Newbie


Joined: 25 August 2005
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nirusoft Quote  Post ReplyReply Direct Link To This Post Topic: VC++ pointer objects
    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

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Nirusoft View Drop Down
Newbie
Newbie


Joined: 25 August 2005
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nirusoft Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Nirusoft View Drop Down
Newbie
Newbie


Joined: 25 August 2005
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nirusoft Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Nirusoft View Drop Down
Newbie
Newbie


Joined: 25 August 2005
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Nirusoft Quote  Post ReplyReply Direct Link To This Post Posted: 27 August 2005 at 11:26am
Thanq   very much for ur help 
Back to Top
jhorigan View Drop Down
Newbie
Newbie
Avatar

Joined: 27 August 2005
Location: United States
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote jhorigan Quote  Post ReplyReply Direct Link To This Post 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()
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.