גיא ציזנר

All generations.

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

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 GetCopy() { return new Person(_name, _age); } public override string ToString() { return _name + " " + _age; } } Person p1 = new Person(); p1.Name = "Jo"; p1.Age = 21; Person p2 = new Person("Jo", 21); Person p3 = p1.GetCopy();

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); } }

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

using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace class_practice { class Program { static void Main(string[] args) { person person = new person(); person.setname("kimber"); person.setage(21); Console.WriteLine("name is: " +person.getname() + " age is: " + person.getage()); person person2 = new person(); person2.setname("Juan"); person2.setage(22); Console.WriteLine("name is: " + person2.getname() + " age is: " + person2.getage()); Console.ReadLine(); } } public class person { public string name { get; set; } public int age { get; set; } public string getname() { return this.name; } public

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 constructor add tostring

class Person { private String name; private int age; public Person(string name, int age) { this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public static void main(String[] args) { Person person1 = new Person("Joe", 25); Person person2 = new Person("John", 30); System.out.println(person1); System.out.println(person2); person2.setAge(35); // update person2's age to 35 System.out.println(person1); System.out.println(person2); } @Override public String toString() { return "Person [name=" + name +

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 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 object Clone(){ return new Person(name, age); } } Person person = new Person("Elon", 48); person.getName() Person copyPerson = person.Clone() as Person;

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; } }

generate functionThu, 22 Dec 2022

add to this class a copy constructor class Person { private String name; private int age; public Person(string name, int age) { this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; }

public Person(Person other) { this.name = other.name; this.age = other.age; } class Program { static void Main(string[] args) { Person p = new Person("mark", 22); Person p2 = new Person(p); } }

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; } }

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; } }

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 constructor add tostring

public class Person { private string name; private int age; public Person(string name, int age) { name = name; age = age; } public string Name { get { return name; } set { name = value; } } public int Age { get { return age; } set { age = value; } } public static Person CreatePerson(string name, int age) { return new Person(name, age); } public Person CopyPerson() { return new Person(this.name, this.age); } public override string ToString() { return $"{name} {age}"; } }

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 add tostring

class Person { public string name { get; set; } public int age { get; set; } public Person(string name, int age) { this.name = name; this.age = age; } public Person Copy() { return new Person(this.name, this.age); } public string ToString() { return String.Format("{0}, {1}", this.name, this.age); } }

generate functionThu, 22 Dec 2022

add to this class a copy constructor class Person { private String name; private int age; public Person(string name, int age) { this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; }

class Person { string Name { get; set; } int Age { get; set; } public Person(string name, int age){ this.Name = name; this.Age = age; } Person(Person p): this(p.Name, p.Age){ } }

Questions about programming?Chat with your personal AI assistant