Click here to Skip to main content
15,885,366 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
    {
         //regular ITalkable class that system can directly talk to.
         public class EnglishSpeakerKid : ITalkable
         {
             public string Name { get; set; }
             public int Age { get; set; }
             public string FavorFood { get; set; }


             #region ITalable Members

             public void TellMeAboutNameInEnglish()
             {
                 Console.WriteLine("My name is {0}", Name);
             }

             public void TellMeAboutAgeInEnglish()
             {
                 Console.WriteLine("I am {0} years old", Age.ToString());
             }

             public void TellMeAboutFavorFoodInEnglish()
             {
                 Console.WriteLine("My favor food is {0}", FavorFood);
             }

             #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