473,407 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Array of classes and a pointer to it

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
Jul 21 '05 #1
5 1104
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" <Ei***@discussions.microsoft.com> wrote in message
news:D0**********************************@microsof t.com...
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

Jul 21 '05 #2
Your code does not compile for Visual C++......
Eitan

"Robbe Morris [C# MVP]" wrote:
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" <Ei***@discussions.microsoft.com> wrote in message
news:D0**********************************@microsof t.com...
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


Jul 21 '05 #3
Eitan <Ei***@discussions.microsoft.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Jul 21 '05 #4
No problem.
Thanks Eitan

"Jon Skeet [C# MVP]" wrote:
Eitan <Ei***@discussions.microsoft.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #5
No problem.
Thanks Eitan

"Jon Skeet [C# MVP]" wrote:
Eitan <Ei***@discussions.microsoft.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: James | last post by:
Hi, I'm hoping someone can help me out. If I declare a class, eg. class CSomeclass { public: var/func etc..... private varfunc etc..
9
by: justanotherguy63 | last post by:
Hi, I am designing an application where to preserve the hierachy and for code substitability, I need to pass an array of derived class object in place of an array of base class object. Since I...
3
by: Mark Dunmill | last post by:
I can't create a Constant/Read-only array field in managed C++ classes - doesn't allow the keyword const pointer to const object on array fields in managed C++ classes. e.g. Want to define a...
2
by: brzozo2 | last post by:
Hello, anyone knows if there is a way to use pointer notation instead of array when it comes to copying one object to another via a pointer of array to objects? Here is a very simple code to show...
19
by: Mark | last post by:
i need to make a class that can store anything (integers,objects,etc) it needs to maintain a list of pointers to these objects the list needs to be resized to accomodate more elements i can't use...
13
by: Jack | last post by:
I have a class called "Base". This class has a protected member variable "m_base" which can be retrieved using the public member function "GetBaseMember". "m_base" is initialized to "1" and is...
15
by: Eric Lilja | last post by:
Hello, in one of my classes I have this member variable: Tile ***tiles_; where Tile is another one of my classes. dimensional array of Tile-pointers (dimensions are of equal sizes). Last, I...
3
by: Peter Oliphant | last post by:
Below are the definitions of two classes. VList creates two static integer arrays (v_0, v_1), creates an array of pointers to these arrays (vlist), and has a public method to return a pointer to...
3
by: aeo3 | last post by:
Hi All, Now, I am trying to build a project, I need to expand an array of pointer to classes. Moreover, this array includes some elements I want to delete them. So, I create another array, copy the...
26
by: aruna.mysore | last post by:
Hi all, I have a specific problem passing a function pointer array as a parameter to a function. I am trying to use a function which takes a function pointer array as an argument. I am too sure...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.