Stanford CS193p
Lecture 1 Slides (September 27, 2011) - Marek Piasecki
Lecture 1 Slides (September 27, 2011) - Marek Piasecki
- No tags were found...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Spaceship.h<br />
#import "Vehicle.h"<br />
#import "Planet.h"<br />
@interface Spaceship : Vehicle<br />
Objective-C<br />
We need to import Planet.h for<br />
method declaration below to work.<br />
#import "Spaceship.h"<br />
@interface Spaceship()<br />
// declaration of private methods (as needed)<br />
Spaceship.m<br />
// declaration of public methods<br />
- (void)orbitPlanet:(Planet *)aPlanet<br />
atAltitude:(double)km;<br />
The full name of this method is<br />
orbitPlanet:atAltitude:<br />
@end<br />
@implementation Spaceship<br />
// implementation of public and private methods<br />
Lining up the colons<br />
makes things look nice.<br />
It takes two arguments.<br />
Note how each is preceded by its own keyword.<br />
It does not return any value.<br />
@end<br />
@end<br />
<strong>Stanford</strong> <strong>CS193p</strong><br />
Fall 2011