Skip to content

Instantly share code, notes, and snippets.

@nanase
Last active August 29, 2015 14:06
Show Gist options
  • Select an option

  • Save nanase/7513e3c485171ab952a8 to your computer and use it in GitHub Desktop.

Select an option

Save nanase/7513e3c485171ab952a8 to your computer and use it in GitHub Desktop.
notepad-lang独自案
abstract class Person:
# protected
prop trueAge [get, private set]
abstract prop age [get]
# public
def me(age):
me.trueAge = age
def tellAge => "私は\(me.age)歳です。"
class HonestPerson extends Person:
protected prop age => me.trueAge
class Liar extends Person:
protected prop age => me.trueAge but if $ > 40 then $ / 2
var mike = new HonestPerson(20)
var ken = new Liar(20)
println "mike: " ~ mike.tellAge
println "ken: " ~ ken.tellAge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment