Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

* | |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / Getting Started / Re: Does Extends == Inheritance && Implements == Composition? on: August 31, 2007, 05:48:38
In the spirit of "There are no dumb questions"...

"So you might give your class a private var called myED that is an instance of EventDispatcher (thats the composition part). But by implementing the IEventDispatcher interface, you allow other classes to make calls like this:

myClass.dispatchEvent(...) instead of myClass.myED.dispatchEvent(...)"

To my (beginner's) mind myClass would need to define all of the public methods in IEventDispatcher to fulfill it's contract and then manually delegate calls to myED within each of one these methods - seems like a lot of typing?

However perhaps I'm missing something clever e.g. perhaps myClass fulfills its contract to implement IEventDispatcher merely by composing with myED:EventDispatcher? And then "knows"  how to delegate myClass.dispatchEvent(...) to the composed object myED?

Cheers, Rich
Pages: [1]