# Proper way to communicate between classes using OOP

**URL:** <https://forum.kirupa.com/t/proper-way-to-communicate-between-classes-using-oop/328451>\
**Category:** Uncategorized\
**Created:** [May 17, 2012, 9:04pm UTC](https://forum.kirupa.com/t/proper-way-to-communicate-between-classes-using-oop/328451 "2012-05-17T21:04:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![icekomo](https://avatars.discourse-cdn.com/v4/letter/i/bcef8e/32.png) [@icekomo](https://forum.kirupa.com/u/icekomo)\
**Post date:** [May 17, 2012, 9:04pm UTC](https://forum.kirupa.com/t/proper-way-to-communicate-between-classes-using-oop/328451/1 "2012-05-17T21:04:24Z")

</div>

I have asked this sort of thing before, but I feel that I have a little more knowledge on the subject now, and just want to see which way is the proper way of communicating between classes. So if I have 3 classes, a Document class, Class A and Class B. The Document class would initiate both Class A and Class B. Now in order for Class A to talk to Class B, I could use a custom event, dispatch an event to the CustomEvent class, but the Document class would have to listen to to that CustomEvent class that and then tell class B what to do.

Or I would create a (var dispatcher:EventDispatcher;) in the Document class and pass that to each class, therefor Class A could dispatch and event to the Custom Event class and with in Class B would listen to the CustomEvent Class and be able to react to it.

I want to know if either of these ways are proper OOP.

Hopefully my simplistic examples make sense!

Thanks!
