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(lo cation,voi d (*f) (location, temperature));
~activetemperaturesensor() ;
void calibrate(temperature actualtemperature);
void establishsetpoint(temperat ure 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
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(lo
~activetemperaturesensor()
void calibrate(temperature actualtemperature);
void establishsetpoint(temperat
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Have fun!
ASKER