19 lines
304 B
Plaintext
19 lines
304 B
Plaintext
class MyClass
|
|
declare name
|
|
|
|
// constructors are methods with the same name as the class
|
|
def MyClass(name)
|
|
this.name = name
|
|
end
|
|
|
|
def getName()
|
|
return name
|
|
end
|
|
end
|
|
|
|
// instantiate a new MyClass object
|
|
inst = new(MyClass, "name string goes here")
|
|
|
|
// display the name value
|
|
println inst.getName()
|