Call an object method: Difference between revisions

m
no edit summary
No edit summary
mNo edit summary
Line 1,234:
<pre>This class represents dogs.
Fido says Woof!</pre>
 
=={{header|Nanoquery}}==
<lang Nanoquery>class MyClass
declare static id = 5
declare MyName
 
// constructor
def MyClass(MyName)
this.MyName = MyName
end
 
// class method
def getName()
return this.MyName
end
 
// static method
def static getID()
return id
end
end
 
// call the static method
println MyClass.getID()
 
// instantiate a new MyClass object with the name "test"
// and call the class method
myclass = new(MyClass, "test")
println myclass.getName()</lang>
{{out}}
<pre>5
test</pre>
 
=={{header|Nemerle}}==
Anonymous user