7/13/2010

C# Interface



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

namespace Interfaces
{
    interface person
    {
           void describe(); // by default, abstract method
    }

    class student : person
    {

        string name;
        int age;

        public student(string name, int age)
        {
            this.name = name;
            this.age = age;
        }

        public void describe()
        {
            Console.WriteLine("Name: " + name + "\n Age: " + age);
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            student s = new student("Kamran", 21);
            s.describe();

        }
    }
}

No comments:

Post a Comment