Click here to Skip to main content
14,599,486 members

C / C++ / MFC

 
AnswerRe: char* returns garbage value Pin
Richard MacCutchan29-Jan-10 22:23
mveRichard MacCutchan29-Jan-10 22:23 
AnswerRe: char* returns garbage value Pin
«_Superman_»30-Jan-10 20:28
professional«_Superman_»30-Jan-10 20:28 
Questionextracting data from .TXT file Pin
benjamin yap29-Jan-10 17:20
Memberbenjamin yap29-Jan-10 17:20 
AnswerRe: extracting data from .TXT file Pin
Richard MacCutchan29-Jan-10 22:19
mveRichard MacCutchan29-Jan-10 22:19 
AnswerRe: extracting data from .TXT file Pin
enhzflep30-Jan-10 7:02
Memberenhzflep30-Jan-10 7:02 
AnswerRe: extracting data from .TXT file Pin
Moak30-Jan-10 13:11
MemberMoak30-Jan-10 13:11 
QuestionAutoRestart + Execute Useer Code Pin
Bram van Kampen29-Jan-10 14:24
MemberBram van Kampen29-Jan-10 14:24 
QuestionAccessing vars in class created with new Pin
al250029-Jan-10 12:48
Memberal250029-Jan-10 12:48 
Hi all,

I have been using the following method to allow multiple instances of a class CInd1 to be generated using a base class pointer with various virtual functions in the base class. The problem I have is that I now would like to access variables in the class CInd1 generated by new. I can't figure out how to do this. The pointer m_pIndicator points to the desired class but it's a CIndicator class pointer (necessary to use virtual functions). Is there any way to re-cast the pointer or similar to gain access to CInd1 variables?

Thanks

class CInd1 : public CIndicator
{

Public:

//vars

virtual void CInd1::Draw(..) const;

CInd1(..); //constructor
CInd1 () {}
};

class CIndicator : public CObject  
{

public:
	//vars

virtual void Draw(CDC* pDC) const {}

public:
	CIndicator() {};
};

//implementation code


CIndicator* m_pIndicator;

m_pIndicator = new CInd1(..);

//access vars in new CInd1?

m_pIndicator-> ?? 

AnswerRe: Accessing vars in class created with new Pin
Avi Berger29-Jan-10 14:00
MemberAvi Berger29-Jan-10 14:00 
GeneralRe: Accessing vars in class created with new Pin
al250029-Jan-10 14:23
Memberal250029-Jan-10 14:23 
GeneralRe: Accessing vars in class created with new Pin
al250029-Jan-10 15:55
Memberal250029-Jan-10 15:55 
GeneralRe: Accessing vars in class created with new Pin
Avi Berger1-Feb-10 11:22
MemberAvi Berger1-Feb-10 11:22 
AnswerRe: Accessing vars in class created with new Pin
Richard MacCutchan30-Jan-10 1:12
mveRichard MacCutchan30-Jan-10 1:12 
GeneralRe: Accessing vars in class created with new Pin
al250030-Jan-10 8:04
Memberal250030-Jan-10 8:04 
QuestionRe: Accessing vars in class created with new Pin
David Crow30-Jan-10 12:52
MemberDavid Crow30-Jan-10 12:52 
AnswerRe: Accessing vars in class created with new Pin
al25001-Feb-10 11:47
Memberal25001-Feb-10 11:47 
QuestionHow to assign directory rights programmatically? Pin
Chintan29-Jan-10 10:38
MemberChintan29-Jan-10 10:38 
QuestionWindows Shell Replacement Pin
Code-o-mat29-Jan-10 9:22
MemberCode-o-mat29-Jan-10 9:22 
AnswerRe: Windows Shell Replacement Pin
Richard MacCutchan29-Jan-10 9:49
mveRichard MacCutchan29-Jan-10 9:49 
GeneralRe: Windows Shell Replacement Pin
Code-o-mat29-Jan-10 10:18
MemberCode-o-mat29-Jan-10 10:18 
GeneralRe: Windows Shell Replacement Pin
Richard MacCutchan29-Jan-10 22:08
mveRichard MacCutchan29-Jan-10 22:08 
GeneralRe: Windows Shell Replacement Pin
Code-o-mat30-Jan-10 6:18
MemberCode-o-mat30-Jan-10 6:18 
GeneralRe: Windows Shell Replacement Pin
Richard MacCutchan30-Jan-10 9:27
mveRichard MacCutchan30-Jan-10 9:27 
AnswerRe: Windows Shell Replacement Pin
Nemanja Trifunovic29-Jan-10 10:04
MemberNemanja Trifunovic29-Jan-10 10:04 
GeneralRe: Windows Shell Replacement Pin
Code-o-mat29-Jan-10 10:24
MemberCode-o-mat29-Jan-10 10:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.