Saturday, June 15, 2013

Decorator Desing pattern

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Data.SqlClient;
using System.Data;
using System.Diagnostics;

namespace BlogProject
{
      
    //Decorator Desing patern in C#
    class FirstClass
    {
        public void fFirstclass()
        {
            Console.WriteLine("I am First Class");
        }
    }

    class SecondClass : FirstClass
    {
        public void fSecondClass()
        {
            Console.WriteLine("I am second class");
        }

    }
    class ThirdClass : SecondClass
    {
        public void fThirdclass()
        {
            Console.WriteLine("I am Third Class");
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            ThirdClass objCls = new ThirdClass();
            objCls.fThirdclass();

            Console.ReadLine();
        }
    }

}



                                                                                                                                                                

1 comment:

  1. what to want to say through this example.

    write small description about Decorator pattern in this example.

    ReplyDelete