Pages

Saturday 3 November 2012

Write a program in C# to implement Multiple Interfaces in a Single class.

Write a program in C# to implement Multiple Interfaces in a Single class.

Description:
In this post we are going to learn the use of dialog control. Include all the five dialog controls like OpenFileDialog,SaveFileDialog,FolderBrowserDialog,FontDialog,ColorDialog.

Open Microsoft visual studio
File-> New -> Project -> visual c#-> console Application.

Program:


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

namespace readwrite
{
    class Program
    {
        static void Main(string[] args)
        {
            Interfaces d = new Interfaces();
            Interfaces1 d1 = new Interfaces();
            Interfaces2 d2 = new Interfaces();
            d1.show1();
            d2.show2();
        }
    }
    interface Interfaces1
    {
        void show1();
    }
    interface Interfaces2
    {
        void show2();
    }

    class Interfaces : Interfaces1, Interfaces2
    {
        public void show1()
        {
            Console.WriteLine("This is Interface1.");
            Console.ReadLine();
        }
        public void show2()
        {
            Console.WriteLine("This is Interface2 ");
            Console.ReadLine();
        }
    }
}

Demo:
Write a program in C# to implement Multiple Interfaces in a Single class.
Write a program in C# to implement Multiple Interfaces in a Single class.

1 comment:

  1. Your post was a great help.I 2 am a ckpcet student.so thanks a lot 4 d program

    ReplyDelete