.Net Practical 11

Practical : 11
Subject : .Net

Aim : Program in C# to Implement Multiple Interfaces in a Single Class. 

Source Code :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace dotnet008
{
    interface drawing
    {
        void draw();
    }
    interface painting
    {
        void color();
    }
    public class circualar : drawing,painting
    {
        public void draw()
        {
            Console.WriteLine("Drawing circular shape...");
        }
        public void color()
        {
            Console.WriteLine("painting circular shape with color red...");
        }
    }
    public class triangular : drawing
    {
        public void draw()
        {
            Console.WriteLine("Drawing triangular shape...");
        }
    }
    class pra11
    {
        static void Main(string[] ar)
        {
            circualar p1 = new circualar();
            p1.draw();
            p1.color();
            triangular t1 = new triangular();
            t1.draw();
            Console.ReadKey();
        }
    }

}
Output : 

Pratik Boghani

Author & Editor

Life is all about the next step.

0 comments:

Post a Comment