Extended Constructor Calls

From The Oxygene Language Wiki
Jump to: navigation, search

This is a Language topic about Oxygene
 

Language Topics Introduction | Structured Overview | Grammar | Keywords | Functions



Very often the first thing to be done after creating a class is to initialize some of its fields and properties.

For example:

with p := new Point(param1, param1) do begin
    p.x := 10;
    p.y := 20;
    // other code
  end;

Oxygene allows you to add named parameters after the normal constructor parameters. These are in the form name := value thus allowing the code above to be replaced by:

with p := new Point(param1, param1, x := 10, y := 20) do begin
    // code
  end;

This extended syntax is only supported for constructor and the named parameters can only be placed after the normal parameters.


See Also

Personal tools
Namespaces

Variants
Actions
Navigation
Getting Started
Sections
If you know
More
Toolbox