generate functionThu, 22 Dec 2022

define class with two properties name as string age as int build get and set methods. regular build class method and a copy type method use old way of get and set add copy type method

class Person { public string name; public int age; public Person(string name, int age) { this.name = name; this.age = age; } public Person(Person other) { name = other.name; age = other.age; } public void SetName(string name) { this.name = name; } public string GetName() { return this.name; } public void SetAge(int age) { this.age = age; } public int GetAge() { return this.age; } }

Questions about programming?Chat with your personal AI assistant