gang-of-4-patterns AT lists.siebelschool.illinois.edu
Subject: Design Patterns discussion
List archive
- From: Ray Tayek <rtayek AT comcast.net>
- To: "Atsushi Tanabe" <ttn13w30a9 AT mx1.ttcn.ne.jp>
- Cc: gang-of-4-patterns AT cs.uiuc.edu
- Subject: Re: [gang-of-4-patterns] Re: <Composite pattern with type checking>
- Date: Mon, 27 Feb 2006 17:11:07 -0800
- List-archive: <http://lists.cs.uiuc.edu/pipermail/gang-of-4-patterns>
- List-id: Design Patterns discussion <gang-of-4-patterns.cs.uiuc.edu>
At 07:02 AM 2/26/2006, you wrote:
Hello.
About the Compsite Pattern, I thought of the implementation with type checking.
A code is as follows.
In main, A leaf object is going to call an Add method, and an error occurs.
make component an interface. http://lci.cs.ubbcluj.ro/~raduking/Books/Design%20Patterns/pat4cfso.htm make leaf an abstract class that returns an empty collection for children and throws on add or remove. do composite as in the book. subclass leaf for terminal nodes.
thanks
---
vice-chair http://ocjug.org/
- [gang-of-4-patterns] Re: <Composite pattern with type checking>, Atsushi Tanabe, 02/26/2006
- RE: [gang-of-4-patterns] Re: <Composite pattern with type checking>, Jesús Alonso, 02/27/2006
- Re: [gang-of-4-patterns] Re: <Composite pattern with type checking>, Atsushi Tanabe, 02/28/2006
- Re: [gang-of-4-patterns] Re: <Composite pattern with type checking>, Ray Tayek, 02/27/2006
- RE: [gang-of-4-patterns] Re: <Composite pattern with type checking>, Jesús Alonso, 02/27/2006
Archive powered by MHonArc 2.6.16.