Thursday, May 6, 2010

example of inheretance clas program

// main class
using System;
using System.Collections.Generic;
using System.Text;


namespace inheretence
{
class Program
{
static void Main(string[] args)
{
woman ee = new woman();
ee.eat();

man rr = new man();

rr.eat();
Console.ReadLine();
}
}
}


// inheretance class

using System;
using System.Collections.Generic;
using System.Text;

namespace inheretence
{
abstract class human
{
public abstract void eat();
{
Console.WriteLine("eatinggggggggggggg");

}
}
class man : human
{
public override void eat()
{
Console.WriteLine("man eating");

}

}

class woman : human
{

public override void eat()
{

Console.WriteLine("woman eating");
}






}
}

No comments:

Post a Comment