Re: making Array of objects of a class
From: clyyy2002 (clyyy2002_at_yahoo.com.cn)
Date: 07/28/04
- Next message: cody: "Re: Is it possible to build a generic runtime C# expression evaluation engine?"
- Previous message: Dies Deambulo: "Re: Copying files using process class in ASP.NET"
- In reply to: Muhammad Aftab Alam: "making Array of objects of a class"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 28 Jul 2004 15:46:34 +0800
try to
using System;
using System.Collections;
namespace Student1
{
class ABC
{
private
string strname;
public void GetData()
{
Console.WriteLine("Enter your Name");
strname = Console.ReadLine();
}
public void Print()
{
Console.WriteLine(strname);
}
};
class Class1
{
[STAThread]
static void Main(string[] args)
{
ABC[] arr = new ABC[6];
for(int i=0;i<arr.Length;i++)
{
arr[i] = new ABC();
}
arr[0].GetData(); // This Line gives exception?
arr[0].Print();
}
}
}
- Next message: cody: "Re: Is it possible to build a generic runtime C# expression evaluation engine?"
- Previous message: Dies Deambulo: "Re: Copying files using process class in ASP.NET"
- In reply to: Muhammad Aftab Alam: "making Array of objects of a class"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|