Array of classes and a pointer to it

G

Guest

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
 
G

Guest

Your code does not compile for Visual C++......
Eitan

Robbe Morris said:
MyClass[] myvar = new MyClass[4,8];

--
2004 and 2005 Microsoft MVP C#
Robbe Morris
http://www.robbemorris.com
http://www.masterado.net/home/listings.aspx



Eitan said:
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
 
J

Jon Skeet [C# MVP]

Eitan said:
Your code does not compile for Visual C++......

You didn't say you wanted it in C++ :)

I suggest that as you're asking a language-specific question, you ask
it in a language-specific newsgroup. In this case,
microsoft.public.dotnet.languages.vc would probably be the best bet.
 
G

Guest

No problem.
Thanks Eitan

Jon Skeet said:
You didn't say you wanted it in C++ :)

I suggest that as you're asking a language-specific question, you ask
it in a language-specific newsgroup. In this case,
microsoft.public.dotnet.languages.vc would probably be the best bet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top