Skip to Content.
Sympa Menu

gang-of-4-patterns - Re: [gang-of-4-patterns] Re: <Composite pattern with type checking>

gang-of-4-patterns AT lists.cs.illinois.edu

Subject: Design Patterns discussion

List archive

Re: [gang-of-4-patterns] Re: <Composite pattern with type checking>


Chronological Thread 
  • 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/





Archive powered by MHonArc 2.6.16.

Top of Page