Print Page | Close Window

VC++ pointer objects

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: General Discussion
Forum Description: Topics Related to Visual C++ MFC Development in General
URL: http://forum.codejock.com/forum_posts.asp?TID=2784
Printed Date: 10 May 2024 at 5:41pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: VC++ pointer objects
Posted By: Nirusoft
Subject: VC++ pointer objects
Date 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




Replies:
Posted By: Oleg
Date 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


Posted By: Nirusoft
Date 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


Posted By: Oleg
Date 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


Posted By: Nirusoft
Date 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.


Posted By: Oleg
Date 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


Posted By: Nirusoft
Date Posted: 27 August 2005 at 11:26am
Thanq   very much for ur help 


Posted By: jhorigan
Date 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()



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net