0

I have the below code for class adapter pattern.

 class clsCollection : CollectionBase
    {
        public virtual void Add(string str)
        {
            List.Add(str);
        }   
    }
    class clsStack : Stack
    {
        public void push(string str)
        {
            this.push(str);
        } 
    }

    class clsCollectionAdapter : clsStack
    {
        public  void Add(string str)
        {
            this.push(str);
        }
    }

I couldnt understand how clscollectionadapter maps with the clscollection ? Is this a right example for class adapter pattern?

Can someone helps me to clarify this?

Tom Cruise
  • 1,395
  • 11
  • 30
  • 58
  • 2
    Your example is not complete, check the following link to understand the usage of the Adapter pattern, it is mainly about wrapping up a set of classes in a standard wrapper class to implement common functionalities exposed by a standard interface http://stackoverflow.com/questions/1299167/understanding-adapter-pattern – Mrinal Kamboj Sep 18 '16 at 14:54
  • @MrinalKamboj the accepted answer for that question is a very good one. (Y) – Supun Wijerathne Sep 19 '16 at 03:12

0 Answers0