A
Andrea Trevisan
I'm following a tutorial tour for Microsoft C# and I ask if
this language supports array of classes like C++.That's a
personal curiosity.
I add the body of the two .cs files of my project which works fine but
commented-out lines:
using System;
namespace My3
{
/// <summary>
/// Summary description for CAMix.
/// </summary>
public class CAMix
{
public CAMix()
{
//
// TODO: Add constructor logic here
//
}
public int i_Y;
}
}
using System;
namespace My3
{
class CMix
{
public int i_Y;
}
struct SMix
{
public int i_Y;
}
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
CMix c_Mix1 = new CMix();
CMix[] c_Mix2 = new CMix[4];
CAMix[] c_Mix3 = new CAMix[4];
SMix s_Mix1;
SMix s_Mix2 = new SMix();
SMix[] s_Mix3 = new SMix[7];
c_Mix1.i_Y = 8;
Console.WriteLine("c_Mix1.i_Y = " + c_Mix1.i_Y.ToString());
/*for (int i_Index = 0; i_Index < c_Mix2.Length; i_Index++)
c_Mix2[0].i_Y = i_Index * 100;*/
/*for (int i_Index = 0; i_Index < c_Mix3.Length; i_Index++)
c_Mix3[0].i_Y = i_Index * 100;*/
s_Mix1.i_Y = 3;
Console.WriteLine("s_Mix1.i_Y = " + s_Mix1.i_Y.ToString());
s_Mix2.i_Y = 15;
Console.WriteLine("s_Mix2.i_Y = " + s_Mix2.i_Y.ToString());
for (int i_Index = 0; i_Index < s_Mix3.Length; i_Index++)
{
s_Mix3[i_Index].i_Y = i_Index * 10;
Console.WriteLine("s_Mix3[{0}].i_Y = " +
s_Mix3[i_Index].i_Y.ToString(), i_Index);
}
}
}
}
This text editor isn't wonderful,but I rely on your wonderful will.
regards
Mr. Trevisan Andrea
this language supports array of classes like C++.That's a
personal curiosity.
I add the body of the two .cs files of my project which works fine but
commented-out lines:
using System;
namespace My3
{
/// <summary>
/// Summary description for CAMix.
/// </summary>
public class CAMix
{
public CAMix()
{
//
// TODO: Add constructor logic here
//
}
public int i_Y;
}
}
using System;
namespace My3
{
class CMix
{
public int i_Y;
}
struct SMix
{
public int i_Y;
}
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
CMix c_Mix1 = new CMix();
CMix[] c_Mix2 = new CMix[4];
CAMix[] c_Mix3 = new CAMix[4];
SMix s_Mix1;
SMix s_Mix2 = new SMix();
SMix[] s_Mix3 = new SMix[7];
c_Mix1.i_Y = 8;
Console.WriteLine("c_Mix1.i_Y = " + c_Mix1.i_Y.ToString());
/*for (int i_Index = 0; i_Index < c_Mix2.Length; i_Index++)
c_Mix2[0].i_Y = i_Index * 100;*/
/*for (int i_Index = 0; i_Index < c_Mix3.Length; i_Index++)
c_Mix3[0].i_Y = i_Index * 100;*/
s_Mix1.i_Y = 3;
Console.WriteLine("s_Mix1.i_Y = " + s_Mix1.i_Y.ToString());
s_Mix2.i_Y = 15;
Console.WriteLine("s_Mix2.i_Y = " + s_Mix2.i_Y.ToString());
for (int i_Index = 0; i_Index < s_Mix3.Length; i_Index++)
{
s_Mix3[i_Index].i_Y = i_Index * 10;
Console.WriteLine("s_Mix3[{0}].i_Y = " +
s_Mix3[i_Index].i_Y.ToString(), i_Index);
}
}
}
}
This text editor isn't wonderful,but I rely on your wonderful will.
regards
Mr. Trevisan Andrea