-
-
Save khanghoang/8ebd8e19d75d15fe845f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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