Decorator

From: al (allin_at_168.net)
Date: 12/23/03


Date: Tue, 23 Dec 2003 02:34:11 GMT

class what
{
   public:
        virtual bool method1();
        ...
};

class Decorator : public what
{
    public:
        bool method1();
        int added_new_method();
        ...
};

Assume method1() is one of the methods interesting client.

Is Decorator so important? Why not just added_new_method() directly into
what class? Additionally, the method1() in what class has to be virtual to
be "decorated" by Decorator class.

Am I missing seeing its importance?

Thank you very much!



Relevant Pages

  • Re: Decorator
    ... the method1() in what class has to be virtual to ... the decorator pattern is a way of creating filters so that input ... Adapter pattern, except the "Adaptee" is derived from the same base ...
    (comp.object)
  • Re: You HAVE to see this mans work - amazing!
    ... He sat in on a meeting between a client and their architect and interior ... decorator. ... The client had a photo of a colonial fireplace mantle she ...
    (rec.crafts.woodturning)
  • Re: Decorator Pattern
    ... The client certainly CAN use the added methods, ... of the decorator go on using the decorator as if it were the ... You know, you are right, the above is not the Adaptor pattern, it's the ... and the public interface is substitutable. ...
    (comp.object)
  • Re: Decorator Pattern
    ... The client certainly CAN use the added methods, ... decorator go on using the decorator as if it were the original object - ... operations that aren't part of the VisualComponent interface." ... must conform to the interface of the component that it decorates." ...
    (comp.object)
  • Re: Decorator
    ... > Am I missing seeing its importance? ... perhaps in a number of successive layers. ... base method must be virtual to allow the decorator to override it. ...
    (comp.object)