Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Classes/Zkl/classes-1.zkl
Normal file
10
Task/Classes/Zkl/classes-1.zkl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
class C{ // define class named "C", no parents or attributes
|
||||
println("starting construction"); // all code outside functions is wrapped into the constructor
|
||||
var v; // instance data for this class
|
||||
fcn init(x) // initializer for this class, calls constructor
|
||||
{ v = x }
|
||||
println("ending construction of ",self);
|
||||
}
|
||||
c1:=C(5); // create a new instance of C
|
||||
c2:=c1("hoho"); // create another instance of C
|
||||
println(C.v," ",c1.v," ",c2.v);
|
||||
3
Task/Classes/Zkl/classes-2.zkl
Normal file
3
Task/Classes/Zkl/classes-2.zkl
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
C.__constructor(); // run base class constructor for giggles
|
||||
C.init(456); // initialize base class without creating instance
|
||||
println(C.v," ",c1.v);
|
||||
Loading…
Add table
Add a link
Reference in a new issue