using System;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
//Object 1
var p1 = new Person
{
FullName = "Le Minh Tuan",
Age = 26,
Address = "Da Nang, Viet Nam"
};
p1.ShowInfo();
//Object 2
var p2 = new Person("Le Khanh Tung", 27, "Da Nang, Viet Nam");
p2.ShowInfo();
//Object 3
var p3 = new Person("Nguyen Van A");
p3.ShowInfo();
Console.ReadLine();
}
}
class Person
{
public string FullName;
public int Age;
public string Address;
//Constructor 1
public Person()
{
//Default Constructor
}
//Constructor 2
public Person(string fullName, int age, string address)
{
FullName = fullName;
Age = age;
Address = address;
}
//Constructor 3
public Person(string fullname)
{
FullName = fullname;
Age = 30;
Address = "Viet Nam";
}
public void ShowInfo()
{
Console.WriteLine(" Name:{0} \n Age: {1} \n Address: {2}", FullName, Age, Address);
}
}
}