473,385 Members | 1,693 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,385 software developers and data experts.

Can anybody tell me what is wrong ....

/*

I am trying to practice multidimensional array in a managed class using
dynamical allocation.

If I tried to compile the following codes, I would get the under mentioned

c2440 error message. It is only practice. You may notice that I am not using
"private"

or constructor here. Can anybody tell me what is wrong and how I can rewrite
that line right?

Thanks a lot.

*/

#include "stdafx.h"

#include <string.h>

#include <string>

#using <mscorlib.dll>

#include <tchar.h>

using namespace System;

using namespace std;

__gc class Month

{

public:

//private:

static const int weekOfMonth = 2;

static const int dayOfWeek = 3;

int pDaysOfMonth[,];

};
int _tmain()

{

Month *March;

March = new Month;

March->pDaysOfMonth = new int[6,7]; //<-----error C2440: '=' : cannot
convert

//from 'int *' to 'int __gc[,]'Can only

//convert a __gc array to or from Object * or Array *

March->pDaysOfMonth[0,0] = 3;

March->pDaysOfMonth[1,1] = 4;

return 0;

}

//Allen
May 18 '06 #1
1 1010
Allen Maki wrote:
/*

I am trying to practice multidimensional array in a managed class
using dynamical allocation.

If I tried to compile the following codes, I would get the under
mentioned
c2440 error message. It is only practice. You may notice that I am
not using "private"

or constructor here. Can anybody tell me what is wrong and how I can
rewrite that line right?

Thanks a lot.
March->pDaysOfMonth = new int[6,7];


March->pDaysOfMonth = __gc new System::Int32[6,7];

-cd
May 18 '06 #2

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

Similar topics

3
by: Jonathan | last post by:
Rather than me explain the problem, read this exchange of emails between my web host and myself, then tell me what I can tell them! I had a problem with their admin site all day, and after me...
11
by: Don Bruder | last post by:
Got a stumper here. I imagine that for someone experienced in C++, this is too pathetic for words. For a rookie, using this project as a sort of "midterm exam" in his self-taught "how to program in...
9
by: andrew | last post by:
Hi, I posted this message recently, but received no response, so I figured I'd try again. I can't find anybody who can tell me what's going on here. I'm having a problem with fieldsets in IE...
3
by: Catalin Porancea | last post by:
Can anybody tell me what is wrong with this code? I would really appreciate some help here. The data grid has 4 columns (0,1,2,3), and 1 is not visible. Whenever I click Edit, I get this error:...
12
by: Ashu | last post by:
can anybody tell me the reason why following code is not working? int *funct() { int p=10; return &p; }
0
by: PhilipDaniels | last post by:
I'm trying to create a tracing system for my application. I want to create a new type of Switch that is basically TraceSwitch with an extra attribute called "includeMethodName". So my application's...
15
by: Konstantin Andreev | last post by:
I'm almost sure I've found bad bug, but for a while I can't neither confirm nor reject this. If anybody could make an independent test on it's own system, I'd appreciate it very much. The...
5
by: Mufasa | last post by:
Does anybody have a slick way to tell if people are on the system. I have a login so I can tell if a user is authenticated. What I've done now is make a dataset that I store in the application...
4
by: turnstyle | last post by:
Hi all, I seem to be having some weird problems with PHP on IIS7, and now I wonder -- is anybody here running PHP on IIS7? Thanks! -Scott
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?

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.