
Security Coding • Chapter 1 21
SetWeight( int )
SetSpeed( int )
SetManeuverability( int )
SetPosition( [ ] )
MoveToPosition( [ ] )
A plane class for such an object might look like the lines of code in Example 1.16.
Example 1.16 Plane Class
1 public class plane{
2 int Weight;
3 int Speed;
4 int Maneuverability
5 Location Position /* The Location type defined elsewhere as an (x, y, z) coordinate */
6
7
plane( int W, int S, int M, Location P ){
8 Weight = W;
9 Speed = S;
10 Maneuverability = M;
11 Position = P;
12 }
13
14
SetWeight( plane current, int W ){
15 Current.Weight = W;
16 }
17
18
/* Additional Methods for SetSpeed, SetWeight, SetPosition, SetManeuverability,
SetPosition ...