C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

c++: pointers to pointers

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
A
Guest





PostPosted: Tue Oct 28, 2003 12:17 pm    Post subject: c++: pointers to pointers Reply with quote



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





PostPosted: Tue Oct 28, 2003 12:35 pm    Post subject: Re: c++: pointers to pointers Reply with quote



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





PostPosted: Wed Oct 29, 2003 8:53 am    Post subject: Re: c++: pointers to pointers Reply with quote





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





PostPosted: Wed Oct 29, 2003 1:15 pm    Post subject: Re: c++: pointers to pointers Reply with quote

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





PostPosted: Wed Oct 29, 2003 3:00 pm    Post subject: Re: pointers to pointers Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.