Click here to Skip to main content
15,917,702 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: casting between pointers Pin
Iosif Murariu16-Jun-10 21:50
Iosif Murariu16-Jun-10 21:50 
GeneralRe: casting between pointers Pin
«_Superman_»16-Jun-10 22:05
professional«_Superman_»16-Jun-10 22:05 
GeneralRe: casting between pointers Pin
Iosif Murariu16-Jun-10 22:10
Iosif Murariu16-Jun-10 22:10 
AnswerRe: casting between pointers Pin
Stephen Hewitt16-Jun-10 21:56
Stephen Hewitt16-Jun-10 21:56 
AnswerRe: casting between pointers Pin
Code-o-mat16-Jun-10 22:08
Code-o-mat16-Jun-10 22:08 
GeneralRe: casting between pointers Pin
Iosif Murariu16-Jun-10 22:11
Iosif Murariu16-Jun-10 22:11 
GeneralRe: casting between pointers Pin
Code-o-mat16-Jun-10 22:52
Code-o-mat16-Jun-10 22:52 
AnswerRe: casting between pointers [modified] Pin
Aescleal16-Jun-10 22:29
Aescleal16-Jun-10 22:29 
No, no way without an explicit cast or maybe a using statement in the derived class. What you're saying is that B is a class that can use A's public members but no one else can. There's no safe reason why you'd want to convert a B * to an A* - the two aren't type compatible.

I'm not trying to be (too) judgemental here, but have you ever considered you're programming in the wrong language? In both your recent posts you've wanted a duck-typed language, one that really doesn't give two hoots what you do with objects - they'll make up their minds at run time whether they want to play or not. If that's the case then use something like Smalltalk or Python that explicitly allows what you want to do - C++ is always going to frustrate you with its stronger typing and lack of emphasis on allowing programmers to use arbitrary runtime type conversions.

Cheers,

Ash

PS: I've think I've finally grokked what your problem is - have a look at the post I've just made in the other thread on this subject.

modified on Thursday, June 17, 2010 4:37 AM

GeneralRe: casting between pointers Pin
Iosif Murariu16-Jun-10 22:39
Iosif Murariu16-Jun-10 22:39 
GeneralRe: casting between pointers Pin
Aescleal16-Jun-10 22:58
Aescleal16-Jun-10 22:58 
AnswerRe: casting between pointers Pin
Tim Craig17-Jun-10 18:08
Tim Craig17-Jun-10 18:08 
QuestionDirect2D - printing / create windows meta file Pin
thomas1234516-Jun-10 21:26
thomas1234516-Jun-10 21:26 
AnswerRe: Direct2D - printing / create windows meta file Pin
salvapatuel230-Jun-10 6:41
salvapatuel230-Jun-10 6:41 
QuestionPDF Creation Pin
Pryabu16-Jun-10 20:35
Pryabu16-Jun-10 20:35 
AnswerRe: PDF Creation Pin
«_Superman_»16-Jun-10 20:51
professional«_Superman_»16-Jun-10 20:51 
GeneralRe: PDF Creation Pin
Pryabu16-Jun-10 21:12
Pryabu16-Jun-10 21:12 
AnswerRe: PDF Creation Pin
mesajflaviu17-Jun-10 5:52
mesajflaviu17-Jun-10 5:52 
QuestionEncrypt text using java and decrypt using C Pin
Murugan k16-Jun-10 19:36
Murugan k16-Jun-10 19:36 
AnswerRe: Encrypt text using java and decrypt using C Pin
Cedric Moonen16-Jun-10 20:12
Cedric Moonen16-Jun-10 20:12 
QuestionRe: Encrypt text using java and decrypt using C Pin
Niklas L16-Jun-10 20:39
Niklas L16-Jun-10 20:39 
AnswerRe: Encrypt text using java and decrypt using C Pin
Moak17-Jun-10 10:49
Moak17-Jun-10 10:49 
GeneralRe: Encrypt text using java and decrypt using C Pin
Niklas L17-Jun-10 11:18
Niklas L17-Jun-10 11:18 
AnswerRe: Encrypt text using java and decrypt using C Pin
Aescleal16-Jun-10 22:43
Aescleal16-Jun-10 22:43 
AnswerRe: Encrypt text using java and decrypt using C Pin
ThatsAlok16-Jun-10 23:54
ThatsAlok16-Jun-10 23:54 
GeneralRe: Encrypt text using java and decrypt using C Pin
Aescleal18-Jun-10 9:23
Aescleal18-Jun-10 9:23 

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.