Click here to Skip to main content
15,889,874 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Polymorphic pointer points to what? Pin
Cedric Moonen17-May-06 1:37
Cedric Moonen17-May-06 1:37 
GeneralRe: Polymorphic pointer points to what? Pin
markkuk17-May-06 3:18
markkuk17-May-06 3:18 
GeneralRe: Polymorphic pointer points to what? Pin
Cedric Moonen17-May-06 3:46
Cedric Moonen17-May-06 3:46 
AnswerRe: Polymorphic pointer points to what? Pin
Sarath C17-May-06 1:35
Sarath C17-May-06 1:35 
QuestionRe: Polymorphic pointer points to what? Pin
David Crow17-May-06 3:13
David Crow17-May-06 3:13 
AnswerRe: Polymorphic pointer points to what? Pin
SimonSays17-May-06 10:47
SimonSays17-May-06 10:47 
GeneralRe: Polymorphic pointer points to what? Pin
G_urr_A17-May-06 11:49
G_urr_A17-May-06 11:49 
GeneralRe: Polymorphic pointer points to what? Pin
G_urr_A17-May-06 13:14
G_urr_A17-May-06 13:14 
Hmm.... Since I've already started a thread, I guess I might as well put it to good use... Wink | ;-)

I've implemented an ugly hack now.
In the code where I give bullets their position and speed, I first find the ship that fired them in ObjectList (which is the vector of *base_class that I've mentioned), then get some data from the ship object. The thing is, I need to access methods that are specific to the CShip class, but I've only got a pointer to base_class to handle it. What I do now is the following:
CShip *temp;
temp = (CShip*)(void*)ObjectList.at(i);

I cast to void* and then to the data type I need. Anything but this explicit casting produces errors, since the compiler doesn't realize that I've checked (using typeid) that what I'm handling is really a CShip object.
This solution is really ugly, IMO. There should be a good way to do this, but I can't figure it out (I'm kind of new to OO).
GeneralRe: Polymorphic pointer points to what? Pin
Stephen Hewitt17-May-06 13:52
Stephen Hewitt17-May-06 13:52 
QuestionWSAGetLastError() 10061 with connect() Pin
Just Baballa17-May-06 1:12
Just Baballa17-May-06 1:12 
JokeRe: WSAGetLastError() 10061 with connect() Pin
RicoH17-May-06 4:11
RicoH17-May-06 4:11 
QuestionRegarding timers Pin
Raja Bose C Leo17-May-06 1:04
Raja Bose C Leo17-May-06 1:04 
AnswerRe: Regarding timers Pin
Cedric Moonen17-May-06 1:11
Cedric Moonen17-May-06 1:11 
AnswerRe: Regarding timers Pin
Sarath C17-May-06 1:15
Sarath C17-May-06 1:15 
GeneralRe: Regarding timers Pin
Raja Bose C Leo17-May-06 2:06
Raja Bose C Leo17-May-06 2:06 
QuestionCScrollView client area update child controls Pin
NovativeDesign17-May-06 1:02
NovativeDesign17-May-06 1:02 
QuestionA difficult question for me to resolve about C++ and Access datetime type Pin
fyr00000017-May-06 0:57
fyr00000017-May-06 0:57 
AnswerRe: A difficult question for me to resolve about C++ and Access datetime type Pin
Cedric Moonen17-May-06 1:08
Cedric Moonen17-May-06 1:08 
AnswerRe: A difficult question for me to resolve about C++ and Access datetime type Pin
Hamid_RT17-May-06 1:17
Hamid_RT17-May-06 1:17 
AnswerRe: A difficult question for me to resolve about C++ and Access datetime type Pin
fyr00000017-May-06 1:23
fyr00000017-May-06 1:23 
GeneralRe: A difficult question for me to resolve about C++ and Access datetime type Pin
fyr00000017-May-06 18:37
fyr00000017-May-06 18:37 
AnswerRe: A difficult question for me to resolve about C++ and Access datetime type Pin
ThatsAlok17-May-06 2:07
ThatsAlok17-May-06 2:07 
QuestionRe: A difficult question for me to resolve about C++ and Access datetime type Pin
David Crow17-May-06 3:17
David Crow17-May-06 3:17 
Questionhow to send HTTPS request to a servlet from vc++ Pin
gbabu1717-May-06 0:42
gbabu1717-May-06 0:42 
AnswerRe: how to send HTTPS request to a servlet from vc++ Pin
surfman1917-May-06 22:54
surfman1917-May-06 22:54 

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.