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

public class Person{ private string name; private int age; public Person(string name, int age) { this.name = name; this.age = 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.name; } }

Questions about programming?Chat with your personal AI assistant