private string firstName;
Console.WriteLine("Person constructor called. Object created");
public Person(string firstName)
this.firstName = firstName;
public Person(string firstName,string lastName)
this.firstName = firstName;
this.lastName = lastName;
public Person(string firstName,string lastName,string eyeColor)
this.firstName = firstName;
this.lastName = lastName;
this.eyeColor = eyeColor;
public Person(string firstName,string lastName,string eyeColor,int age)
this.firstName = firstName;
this.lastName = lastName;
this.eyeColor = eyeColor;
if(firstName != null && lastName != null && age !=0 && eyeColor !=null)
Console.WriteLine("Hi, I am {0} {1}. My eye color is {2} and I am {3} years old",firstName,lastName,eyeColor,age);
else if(firstName != null && lastName != null && eyeColor !=null)
Console.WriteLine("Hi, I am {0} {1}. My eye color is {2}",firstName,lastName,eyeColor);
else if(firstName != null && lastName != null)
Console.WriteLine("Hi, I am {0} {1}.",firstName,lastName);
else if(firstName != null)
Console.WriteLine("Hi, I am {0}.",firstName);
public static void Main()
Person person = new Person();
Person mosh = new Person("Mosh");
Person rayees = new Person("Rayees","Bhat");
Person asif = new Person("Asif","Khan","Brownn");
Person shakir = new Person("Shakir","lone","Amber",26);