The Hyper Programming Language |
home | language reference | compiler | hyper on launchpad |
A new expression creates an instance of a class by calling one of the constructors of that class, and then returns a pointer to the newly created object.
The syntax of a new expression is:
new classname(argument_list)
The argument list is optional, and for an empty argument list the brackets can be omitted. With respect to the arguments given, the same rules hold for a constructor call as they do for a procedure call.
procedure p(x : byte) : * int var a : * int = new int var b : int = a var c : * string = new string("hello") return new int(x) end