Click here to Skip to main content
15,886,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: TCP/IP client / serveur and Win7 Pin
shoppinit25-Jan-11 21:55
shoppinit25-Jan-11 21:55 
AnswerRe: TCP/IP client / serveur and Win7 Pin
Richard MacCutchan24-Jan-11 10:30
mveRichard MacCutchan24-Jan-11 10:30 
Questionwhat is the type of this pointer and also object? Pin
aesthetic.crazy24-Jan-11 4:50
aesthetic.crazy24-Jan-11 4:50 
AnswerRe: what is the type of this pointer and also object? Pin
Richard MacCutchan24-Jan-11 5:06
mveRichard MacCutchan24-Jan-11 5:06 
GeneralRe: what is the type of this pointer and also object? Pin
CPallini24-Jan-11 5:30
mveCPallini24-Jan-11 5:30 
GeneralRe: what is the type of this pointer and also object? Pin
aesthetic.crazy25-Jan-11 0:08
aesthetic.crazy25-Jan-11 0:08 
GeneralRe: what is the type of this pointer and also object? Pin
Richard MacCutchan25-Jan-11 2:31
mveRichard MacCutchan25-Jan-11 2:31 
AnswerRe: what is the type of this pointer and also object? PinPopular
Aescleal24-Jan-11 5:37
Aescleal24-Jan-11 5:37 
The type of the pointer is determined by the left hand side of the expression. The type of the created object is determined by the right hand side of the expression.

One interesting thing about C++ and C (to a lesser extent) is that when you declare a pointer you're not saying "this variable is a pointer to fixed class" but you're saying "this variable is a pointer to something with an interface of this type." In c this really only shows up when you convert to and from void * but in C++ it crops up a lot more (it's how C++ implements substitutability, AKA the Liskov Principle).

From this lot, when you write the expression:

A *p = new B;


you're saying two things to the compiler "p is a pointer to something with the interface of A" and "initialise that pointer with the address of a dynamically allocated B."

Cheers,

Ash
GeneralRe: what is the type of this pointer and also object? Pin
Chris Meech24-Jan-11 9:47
Chris Meech24-Jan-11 9:47 
QuestionApplication Error Pin
shiv@nand24-Jan-11 0:34
shiv@nand24-Jan-11 0:34 
AnswerRe: Application Error Pin
Hans Dietrich24-Jan-11 0:48
mentorHans Dietrich24-Jan-11 0:48 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 1:01
shiv@nand24-Jan-11 1:01 
GeneralRe: Application Error Pin
Andrew Brock24-Jan-11 1:07
Andrew Brock24-Jan-11 1:07 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 1:19
shiv@nand24-Jan-11 1:19 
GeneralRe: Application Error Pin
Hans Dietrich24-Jan-11 1:25
mentorHans Dietrich24-Jan-11 1:25 
AnswerRe: Application Error Pin
Stephen Hewitt24-Jan-11 1:45
Stephen Hewitt24-Jan-11 1:45 
AnswerRe: Application Error Pin
Malli_S24-Jan-11 2:11
Malli_S24-Jan-11 2:11 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 4:26
shiv@nand24-Jan-11 4:26 
GeneralRe: Application Error Pin
Hans Dietrich24-Jan-11 4:35
mentorHans Dietrich24-Jan-11 4:35 
GeneralRe: Application Error Pin
shiv@nand24-Jan-11 4:38
shiv@nand24-Jan-11 4:38 
GeneralRe: Application Error Pin
Hans Dietrich24-Jan-11 4:48
mentorHans Dietrich24-Jan-11 4:48 
GeneralRe: Application Error [modified] Pin
shiv@nand24-Jan-11 5:01
shiv@nand24-Jan-11 5:01 
QuestionRe: Application Error Pin
David Crow24-Jan-11 5:29
David Crow24-Jan-11 5:29 
QuestionDiffrent language string data problem? Pin
Le@rner23-Jan-11 23:35
Le@rner23-Jan-11 23:35 
AnswerRe: Diffrent language string data problem? Pin
Andrew Brock23-Jan-11 23:41
Andrew Brock23-Jan-11 23:41 

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.