Link to home
Start Free TrialLog in
Avatar of alanpong
alanpong

asked on

NewBie question : call back function.

From the example of Booch's book :
Object Oriented Analysis and Design with Application (p.45,46)
There are two similar classes :
e.g. 1 :
typedef float temperature;
typedef unsigned int location;
class temperaturesensor{
public :
temperaturesensor(location);
~temperaturesensor();
void calibrate(temperature actual temperature);
temperature currenttemperature() const;
private :
.....
}


e.g. 2 :
class activetemperaturesensor{
public :
activetemperaturesensor(location,void (*f) (location, temperature));
~activetemperaturesensor();
void calibrate(temperature actualtemperature);
void establishsetpoint(temperature setpoint, temperature delta);
temperature currenttemperature() const ;
private :
....
}


The second one has a callback function and is so called a
more 'active' class.
(the first one is called a 'passive' one.)
Can someone explain it more detail?

many thanks.
rgds.
alanpong@hkstar.com
ASKER CERTIFIED SOLUTION
Avatar of alexo
alexo
Flag of Antarctica image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alanpong
alanpong

ASKER

very happy!
Have fun!