Click here to Skip to main content
15,881,044 members
Articles / Programming Languages / C#

Adapter Design Pattern

Rate me:
Please Sign up or sign in to vote.
5.00/5 (13 votes)
8 Oct 2009CPOL4 min read 61K   587   70  
This article shows a case study about how we use the Adapter Pattern to Elizabeth's Day Care Center
using System;

namespace www.askbargains.com
{
     namespace AdapterDesignPattern
    {
         public class Teacher : ICommunicator
         {

             public ITalkable ObjectToTalk { get; set; }

             #region ICommunicator Members

             //Implementing the Chatting procedures.
             public void StartChatting()
             {
                 Console.WriteLine("What's your name?");
                 ObjectToTalk.TellMeAboutNameInEnglish();

                 Console.WriteLine("How old are you?");
                 ObjectToTalk.TellMeAboutAgeInEnglish();

                 Console.WriteLine("What's your favor food");
                 ObjectToTalk.TellMeAboutFavorFoodInEnglish();
             }

             #endregion
         }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
United States United States
Sr Software Architect.Microsoft Certified Solutions Developer (MCSD).

Comments and Discussions