Skip to content

Instantly share code, notes, and snippets.

@khanghoang
Created December 29, 2015 12:20
Show Gist options
  • Save khanghoang/8ebd8e19d75d15fe845f to your computer and use it in GitHub Desktop.
Save khanghoang/8ebd8e19d75d15fe845f to your computer and use it in GitHub Desktop.
// The car interface
inteface Vehicle
- (void)run
// class Car conforms `Vehicle` interface
class Car conforms Vehicle {
// override run method
- (void)run() {
console.log("Car is running");
}
}
class Human {
- (void)drive:(car :Vehicle) {
car.run();
}
}
var khang = new Human();
var hondaCivic = new Car();
khang.drive(hondaCivic);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment