using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
SharedCountry shujaat = new SharedCountry("shujaat", 27);
Console.WriteLine(shujaat.getInformation());
Console.WriteLine(shujaat.getCountry());
Console.WriteLine(shujaat.getBirthday());
SharedCountry ali = new SharedCountry("ali", 26);
Console.WriteLine(ali.getInformation());
Console.WriteLine(ali.getCountry());
Console.WriteLine(ali.getBirthday());
DifferentCountry atif = new DifferentCountry("atif", 23);
Console.WriteLine(atif.getInformation());
Console.WriteLine(atif.getCountry());
Console.WriteLine(atif.getBirthday());
}
}
public interface Information {
string Name {get; set;}
int Age {get; set;}
String getInformation();
String getCountry();
String getBirthday();
}
public class SharedCountry: Information {
public string Name {get;set;}
public int Age {get;set;}
public SharedCountry(string name, int age){
Name= name;
Age= age;
}
public String getInformation(){
return "Your name is :" + this.Name + " Your Age is :" + this.Age;
}
public String getCountry(){
return "Pakistan";
}
public string getBirthday(){
return "april 23 1990";
}
}
public class DifferentCountry: Information {
public string Name {get;set;}
public int Age {get;set;}
public DifferentCountry(string name, int age){
Name= name;
Age= age;
}
public String getInformation(){
return "Your name is :" + this.Name + " Your Age is :" + this.Age;
}
public String getCountry(){
return "UK";
}
public string getBirthday(){
return "april 23 1990";
}
}
}
|