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; private int _age; public string Name { get { return _name; } set { _name = value; } } public int Age { get { return _age; } set { _age = value; } } public Person() { _name = ""; _age = 0; } public Person(string name, int age) { _name = name; _age = age; } public Person(Person person) { _name = person.Name; _age = person.Age; } }

Questions about programming?Chat with your personal AI assistant