Array of classes and a pointer to it

Array of classes and a pointer to it

Post by RWl0YW » Thu, 05 May 2005 09:20:03


Hello,

I defined a class name MyClass.

I would like to define an array of 4 by 8 of that class.
I would like to define a pointer to the array of MyClass.

I tried it with static definition:
MyClass m_MyClass[4][8] ;
I can not seem to find the way to define a pointer to this array?!?!?

I tried also to define it with the new operator but had similar results.

Any ideas how to do it?

Eitan
 
 
 

Array of classes and a pointer to it

Post by Peter van » Fri, 06 May 2005 23:36:44


The issue is how the compiler actually sees a two dimensional array. There
numerous articles available in the Google Groups archives on this topic
(search on "pointer to two dimensional array"). Here's a web page that
discusses it:

http://www.yqcomputer.com/


--
Peter [MVP Visual Developer]
Jack of all trades, master of none.

 
 
 

Array of classes and a pointer to it

Post by UmF2aWNoYW » Wed, 18 May 2005 16:20:06

An array of 4 by 8 would be declared as

MyClass[4,8] o;

BTW, what is the language that you are referring to? By your naming
convention and the need for pointers makes me think that you are probably
talking about c++.

Pls clarify.

with regards,

J.V.