A
Arjen
Hello,
I have made a class "main" and "person".
I have created new persons inside main.
How can I save this person inside an array?
And how does pointers work?
Thanks!
// -----------------------------------------------------
public class Main {
public Main() {
// Create a new person
Person _NewPerson = new Person();
_NewPerson.Name = "James";
// Create a new person
Person _NewPerson2 = new Person();
_NewPerson2.Name = "John";
// Code
}
}
// -----------------------------------------------------
// -----------------------------------------------------
// Array of persons
// public Person[] _Persons;
public class Person: Main {
// The name of the person
private string _Name;
public string Name {
get {
return _Name;
}
set {
_Name = value;
}
}
}
// -----------------------------------------------------
I have made a class "main" and "person".
I have created new persons inside main.
How can I save this person inside an array?
And how does pointers work?
Thanks!
// -----------------------------------------------------
public class Main {
public Main() {
// Create a new person
Person _NewPerson = new Person();
_NewPerson.Name = "James";
// Create a new person
Person _NewPerson2 = new Person();
_NewPerson2.Name = "John";
// Code
}
}
// -----------------------------------------------------
// -----------------------------------------------------
// Array of persons
// public Person[] _Persons;
public class Person: Main {
// The name of the person
private string _Name;
public string Name {
get {
return _Name;
}
set {
_Name = value;
}
}
}
// -----------------------------------------------------