Hello!
I'm yust starting with C# and object programming and I must admit that it is not easy.
I have a question how to create class with folowing structure:
string Name;
string Surname;
int Age;
clsAdress clsAdressA[5]; "And now come the hard thing for me!"
clsAddress
{
string Address;
int HomeNr;
string State;
}
Can anyone help me how to solve that?
Problem is with this custom data type clsAdress!!
Any info is welcome.
Regards!
Loading
theLizardPosted Jan 7, 2010, 7:17 PM
public class clsAddress
{
public string strAddress; //these cannot be static
public string strState;
}
public static class clsPerson
{
public static string strName;
public static string strSurName;
public static int intAge;
public static clsAddress[] address = new clsAddress[5];
use :
clsPerson.strName = "Name";
clsPerson.address[0].strState = "State";
clsPerson.address[0].strAddress = "Address";
carle laiPosted Jan 11, 2010, 9:11 PM
{
string Address;
int HomeNr;
string State;
}
public class Class1
{
string Name;
string Surname;
int Age;
clsAddress[] clsAdressA;
public Class1()
{
clsAdressA = new clsAddress[5];
}
}
DaniloPosted Jan 8, 2010, 12:23 PM
DaniloPosted Jan 7, 2010, 4:29 PM
Basicly in this case I'd like to have STATIC class.
public static class clsPearson
{
public static string strName;
public static string strSurName;
public static int intAge;
public static clsAddress clsAdressA;
// now the question is; How can I make 5 different adresses inside that
// can be called as indexes
public class clsAddress
{
public static string strAddress;
public static string strState;
}
{
Regards!
theLizardPosted Jan 7, 2010, 4:09 PM
internal class person
{
internal struct p
{
internal string name;
internal string surname;
internal double age;
}
public p record;
public p person()
{
return(new record());
}
}
person.p[] p = new person.p[5];
p[0].name = "Name";
p[0].surname = "Surname";
p[1].name = "Name";
p[1].surname = "Surname";