-
-
Save hotpotato/767978 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
trait Position { | |
private var y:Int; | |
public function getX():Int; | |
public function getY():Int { | |
return y; | |
} | |
} | |
class Hero with Position { | |
} | |
/////////////////////////////////////// | |
interface Position { | |
public function getX():Int; | |
public function getY():Int; | |
} | |
class Hero implements Position { | |
private var y:Int; | |
public function getY():Int { | |
return y; | |
} | |
} |
This file contains hidden or 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
trait Position { | |
public function getX():Int; | |
public function getY():Int { | |
return y; | |
} | |
} | |
class Hero with Position { | |
private var y:Int; | |
} | |
//////////////////////////////////////////////// | |
interface Position { | |
public function getX():Int; | |
public function getY():Int; | |
} | |
class Hero implements Position { | |
private var y:Int; | |
public function getY():Int { | |
return y; | |
} | |
} |
This file contains hidden or 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
trait Position { | |
var x:Int; | |
var y:Int; | |
public function getX():Int { | |
return x; | |
} | |
public function getY():Int { | |
return y; | |
} | |
} | |
trait Color { | |
var color:Int; | |
public function getColor ():Int { | |
return color; | |
} | |
} | |
class Hero with Position, with Color { | |
} | |
///////////////////////////////////////////////////////////////////////// | |
interface Position { | |
public function getX():Int; | |
public function getY():Int; | |
} | |
interface Color { | |
public function getColor ():Int; | |
} | |
class Hero with Position, with Color { | |
var x:Int; | |
var y:Int; | |
var color:Int; | |
public function getX():Int { | |
return x; | |
} | |
public function getY():Int { | |
return y; | |
} | |
public function getColor ():Int { | |
return color; | |
} | |
} |
This file contains hidden or 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
trait Position { | |
public function getX():Int; | |
public function getY():Int { | |
return y; | |
} | |
} | |
class Hero with Position { | |
} | |
/////////////////////////////////////////////// | |
interface Position { | |
public function getX():Int; | |
public function getY():Int; | |
} | |
// Compile Time error because Hero has no field y | |
class Hero implements Position { | |
public function getY():Int { | |
return y; | |
} | |
} |
This file contains hidden or 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
trait Position { | |
public function getX():Int; | |
public function getY():Int; | |
} | |
class Hero with Position { | |
} | |
///////////////////////////////////////////////////// | |
interface Position { | |
public function getX():Int; | |
public function getY():Int; | |
} | |
class Hero implements Position { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment