Click here to Skip to main content
15,887,485 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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
benjamin 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 PinPopular
enhzflep30-Jan-10 7:02
enhzflep30-Jan-10 7:02 
AnswerRe: extracting data from .TXT file Pin
Moak30-Jan-10 13:11
Moak30-Jan-10 13:11 
QuestionAutoRestart + Execute Useer Code Pin
Bram van Kampen29-Jan-10 14:24
Bram van Kampen29-Jan-10 14:24 
QuestionAccessing vars in class created with new Pin
al250029-Jan-10 12:48
al250029-Jan-10 12:48 
AnswerRe: Accessing vars in class created with new Pin
Avi Berger29-Jan-10 14:00
Avi Berger29-Jan-10 14:00 
What you are experiencing is a warning that you probably have a design problem.

If you are working on objects via pointers to a base class, generally all that the code that uses the base class pointer should care about is the base class interface, irregardless of whether the actual object is of base class or derived type.

The immediate questions that your post brings up are: Why are you using a pointer to a dynamically allocated object here? Is there a better design available?

If you are really stuck with this yucky situation the next questions are: How do I know the what the actual type of object this pointer is pointer to is? What do I do in which case of what derived type it is? Can't I come up with a better design that avoids the mess I may be creating?

The best thing to do would probably be to share the situation & your design goal, so that people can give you advice on other ways of dealing with it.

If all my ranting and raving doesn't dissuade you, then you probably want to look up and familiarize yourself with the C++ dynamic_cast<> operator.
GeneralRe: Accessing vars in class created with new Pin
al250029-Jan-10 14:23
al250029-Jan-10 14:23 
GeneralRe: Accessing vars in class created with new Pin
al250029-Jan-10 15:55
al250029-Jan-10 15:55 
GeneralRe: Accessing vars in class created with new Pin
Avi Berger1-Feb-10 11:22
Avi 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
al250030-Jan-10 8:04 
QuestionRe: Accessing vars in class created with new Pin
David Crow30-Jan-10 12:52
David Crow30-Jan-10 12:52 
AnswerRe: Accessing vars in class created with new Pin
al25001-Feb-10 11:47
al25001-Feb-10 11:47 
QuestionHow to assign directory rights programmatically? Pin
Chintan29-Jan-10 10:38
Chintan29-Jan-10 10:38 
QuestionWindows Shell Replacement Pin
Code-o-mat29-Jan-10 9:22
Code-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
Code-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
Code-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
Nemanja Trifunovic29-Jan-10 10:04 
GeneralRe: Windows Shell Replacement Pin
Code-o-mat29-Jan-10 10:24
Code-o-mat29-Jan-10 10:24 
AnswerRe: Windows Shell Replacement Pin
Rolf Kristensen29-Jan-10 12:21
Rolf Kristensen29-Jan-10 12:21 

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.