[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[COMP/HELP]Generalised event handler



Cha`o ca'c ba'c,

In Windows programming we have event handlers that get
called when an event such as a mouse click occurs.

I've been thinking that it would be nice to be able to include
in a function's definition when that function would be called.

Eg:

We have the function TakeImmodiumTablet. It would be
nice to specify in the function definition that it would
get called whenever LooseStool is true, no matter how
that occurs. That would be nicer than having to specify in the 
program

EatSourFruit, if LooseStool then TakeImmodiumTablet,
...
DringSimmingPoolWater, if LooseStool then TakeImmodiumTablet,
...
EatUnwashedVegetable, if LooseStool then TakeImmodiomTablet.

Can I do that in C++?

Thanks,

Huy