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

public class Person { private string _name { get; set; } private int _age { get; set; } 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._age; } public Person clone() { return new Person(this._name, this._age); } }

Questions about programming?Chat with your personal AI assistant