Click here to Skip to main content
15,895,084 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionhow to rotate text without having to select another font Pin
didida6-May-03 5:02
sussdidida6-May-03 5:02 
AnswerRe: how to rotate text without having to select another font Pin
basementman6-May-03 6:08
basementman6-May-03 6:08 
GeneralPls Help Me. Pin
stilgar6-May-03 4:54
stilgar6-May-03 4:54 
GeneralCopy a pointer to an element of an array of pointers Pin
Majid Shahabfar6-May-03 4:13
Majid Shahabfar6-May-03 4:13 
GeneralRe: Copy a pointer to an element of an array of pointers Pin
David Crow6-May-03 4:28
David Crow6-May-03 4:28 
GeneralRe: Copy a pointer to an element of an array of pointers Pin
Hans Ruck6-May-03 4:28
Hans Ruck6-May-03 4:28 
GeneralRe: Copy a pointer to an element of an array of pointers Pin
jhaga6-May-03 4:36
professionaljhaga6-May-03 4:36 
GeneralRe: Copy a pointer to an element of an array of pointers Pin
Peter Mares6-May-03 4:48
Peter Mares6-May-03 4:48 
the line

ClassA *ptr = new ClassA[5];

defines an array of 5 ClassA objects, not an array of 5 ClassA pointers.

If you want an array of 5 ClassA pointers, your declaration will have to be:

ClassA **ptr = new ClassA*[5];

and then you will be able to execute the following code (or similar):

<br />
ClassA *ptr1 = somePointerOFClassA;<br />
ClassA *ptr2 = somePointerOFClassA;<br />
<br />
ptr[0] = ptr1;<br />
ptr[1] = ptr2;<br />


Now, coming back to your previously mentioned code block.Unfortunately, once you have defined an array as you have :

ClassA *ptr = new ClassA[5];

You cannot actually change the address of an element within that array, ie, you cannot do this:

&ptr[0] = ptr1



Hope this helps some.
Cheers,
Peter

-------------------------------------------
99 little bugs in the code, 99 little bugs,
Fix 1 bug, recompile....
101 little bugs in the code...
GeneralCoCreateInstance Tracing Pin
Daniel Turini6-May-03 4:01
Daniel Turini6-May-03 4:01 
GeneralFinding/Loading resources Pin
will13836-May-03 3:37
will13836-May-03 3:37 
GeneralRe: Finding/Loading resources Pin
David Crow6-May-03 4:06
David Crow6-May-03 4:06 
GeneralRe: Finding/Loading resources Pin
will13836-May-03 4:34
will13836-May-03 4:34 
GeneralRe: Finding/Loading resources Pin
David Crow6-May-03 4:39
David Crow6-May-03 4:39 
GeneralRe: Finding/Loading resources Pin
will13836-May-03 4:44
will13836-May-03 4:44 
GeneralRe: Finding/Loading resources Pin
basementman6-May-03 4:50
basementman6-May-03 4:50 
GeneralRe: Finding/Loading resources Pin
will13836-May-03 5:16
will13836-May-03 5:16 
GeneralRe: Finding/Loading resources Pin
basementman6-May-03 5:24
basementman6-May-03 5:24 
GeneralRe: Finding/Loading resources Pin
will13836-May-03 5:36
will13836-May-03 5:36 
GeneralRe: Finding/Loading resources Pin
David Crow6-May-03 6:02
David Crow6-May-03 6:02 
GeneralRe: Finding/Loading resources Pin
will13836-May-03 6:47
will13836-May-03 6:47 
GeneralRe: Finding/Loading resources Pin
will13836-May-03 7:21
will13836-May-03 7:21 
GeneralProblem regerding LineTo(..) Pin
summo6-May-03 3:21
summo6-May-03 3:21 
GeneralRe: Problem regerding LineTo(..) Pin
JensB6-May-03 4:42
JensB6-May-03 4:42 
GeneralRe: Problem regerding LineTo(..) Pin
John R. Shaw6-May-03 7:07
John R. Shaw6-May-03 7:07 
GeneralCFile %&% Pin
macmac386-May-03 2:50
macmac386-May-03 2:50 

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.