| View previous topic :: View next topic |
| Author |
Message |
A Guest
|
Posted: Tue Oct 28, 2003 12:17 pm Post subject: c++: pointers to pointers |
|
|
Hi,
I have an array of pointers defined as such:
myArray** ptr = new myArray[10];
for some reason i get a compile time error stating there is no default
constructor for myArray. The problem is that i should not need to define one
since myArray is a pointer to a pointer and so should not have a default
constructor - its a primitive data type and not an object.
Any help appreciated.
Regards,
A
|
|
| Back to top |
|
 |
Rob Williscroft Guest
|
Posted: Tue Oct 28, 2003 12:35 pm Post subject: Re: c++: pointers to pointers |
|
|
A wrote in news:3f9e5e27_1 (AT) news (DOT) iprimus.com.au:
| Quote: | Hi,
I have an array of pointers defined as such:
myArray** ptr = new myArray[10];
|
myArray** ptr = new myArray *[10];
| Quote: |
for some reason i get a compile time error stating there is no default
constructor for myArray. The problem is that i should not need to
define one since myArray is a pointer to a pointer and so should not
have a default constructor - its a primitive data type and not an
object.
|
HTH.
Rob.
--
http://www.victim-prime.dsl.pipex.com/
|
|
| Back to top |
|
 |
A Guest
|
Posted: Wed Oct 29, 2003 8:53 am Post subject: Re: c++: pointers to pointers |
|
|
| Quote: |
Hi,
I have an array of pointers defined as such:
myArray** ptr = new myArray[10];
myArray** ptr = new myArray *[10];
|
Bingo!
Thanks Rob
|
|
| Back to top |
|
 |
Alan Kelon Guest
|
Posted: Wed Oct 29, 2003 1:15 pm Post subject: Re: c++: pointers to pointers |
|
|
Hi,
| Quote: | myArray** ptr = new myArray[10];
myArray** ptr = new myArray *[10];
|
Or myArray* ptr = new myArray [10];
Regards,
Alan Kelon
|
|
| Back to top |
|
 |
Rochester Guest
|
Posted: Wed Oct 29, 2003 3:00 pm Post subject: Re: pointers to pointers |
|
|
| Quote: | myArray** ptr = new myArray[10];
|
Even if you added a default constructor, this wouldn't compile. I suspect
that you wanted to say:
myArray** ptr = new myArray*[10];
|
|
| Back to top |
|
 |
|