Download 8. Intro to Object
Transcript
class AirPosition{
private:
float latitude;
float longitude;
long altitude;
public:
AirPosition(float latParam,
float longParam,
long altParam){
latitude = latParam;
longitude = longParam;
altitude = altParam;
}
void initialize( float latParam,
float longParam,
long altParam){
latitude = latParam;
longitude = longParam;
altitude = altParam;
}
void drop(int dropHeight){
altitude = altitude - dropHeight;
}
};
You can see that this class definition is getting very
long. I will show you in future how to create a
declaration that just contains member function
prototypes rather than the whole function body’s
definitions. The definitions are put outside the
declaration’s braces {}, possibly even in a different file.
Copyright 1998 by R. Tront
8-25
Copyright 1998 by R. Tront
8-26