Professional Documents
Culture Documents
class Person
{
public int age;
public string name;
this.name = name;
this.age = age;
Console.WriteLine("The age of person is {0},
{1}", name, age);
}
class Employee:Person
{
public int baseLevel;
public int bonusLevel;
public int salary;
public Employee(int age,string name, int
baseLevel, int bonusLevel)
: base(age,name)
{
this.baseLevel = baseLevel;
this.bonusLevel = bonusLevel;
Console.WriteLine("This is child class
constructor {0},{1},{2},{3}",age,name, baseLevel,
bonusLevel);
}
public void TakeSalary()
{
salary = baseLevel + bonusLevel;
Console.WriteLine("The salary of
employee is {0}", salary);
} }}
class Program
{
static void Main(string[] args)
{
emp.getname(100,"qayoom");
emp.TakeSalary();
Console.ReadKey();
}
}
Program#2
class window
{
public int top;
public int left;
// constructor takes two integers to
// fix location on the console
public window( int top, int left )
{
this.top = top;
this.left = left;
}
class listbox:window
{
public string mListBoxContents;
// constructor adds a parameter
public listbox( int top, int left, string
theContents ):
base( top, left ) // call base constructor
{
mListBoxContents = theContents;
}
class Program
{
static void Main(string[] args)
{
window w = new window(5, 10);
w.DrawWindow();
}
}