Alex Rivera | Logout

Custom events in C++?

Asked 2008-09-16T22:34:20.453
9

Is it possible to create custom events in C++? For example, say I have the variable X, and the variable Y. Whenever X changes, I would like to execute a function that sets Y equal to 3X. Is there a way to create such a trigger/event? (triggers are common in some databases)

Edit
Report

1 Answer

1

Think you should read a little about Design Patterns, specifically the Observer Pattern.

Qt from Trolltech have implemented a nice solutions they call Signals and Slots.

answered 2008-09-16T22:36:51.397

Your Answer