Wiki
Version 3 (modified by todd.a, 14 years ago)

--

Extended Initialization

Allows setting of class instance property values in instance constructor call. Given

use System.Drawing
class Rectangle
    var _p1 as Point
    var _p2 as Point
    
    pro p1 from var 
    pro p2 from var

    def toString as String is override
        return 'Rect{[.p1],[.p2]}'

Then

    r = Rectangle(p1=Point(x=0, y=1), p2=Point(x=2, y=3))
    c = Customer('Acme, Inc.', region=Regions.South)

is approx equiv to

    r = Rectangle()
        p1=Point()
        p1.x=0
        p1.y=1
        r.p1 = p1
        p2=Point()
        p2.x=2
        p2.y=3
        r.p2 = p2

        c = Customer('Acme, Inc.')
        c.region=Regions.South