Friday 2 December 2011

Simple Programe in C Sharpe ASP.net Langugage for the Concept of Inheritance


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

namespace TahirKhalid
{
    class Program
    {
        static void Main(string[] args)
        {
            //Human h = new Human();
            //h.eating();

            Employee e = new Employee();
            e.eating(); // where eating is function

            Console.ReadLine();
            }


        public class Human {
            public string eye;
            public string color;
            public string apperance;

            public void eating() {
                Console.WriteLine("i eat food");
            }

            public void speaking()
            {
                Console.WriteLine("i speak");
            }
           
       
        } //end Human class

        public class Employee:Human {

            public int salary;
            public string grade;


            public void calsalary() { salary = 2500;
            Console.WriteLine(salary);
            }
            public void calgrade() { grade = "manager"; }

       
        }
    }
}

No comments:

Post a Comment