The Hyper Programming Language

`New' Expressions

General

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.

Example

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

See also


Valid HTML 4.01 Strict Valid CSS!