You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Introduce constructor and regularize construction of objects in a hierarchy #14
To instantiate an object of a class that inherits from another class, the new expression takes all parameters from the superclass(es) and the class, in the sequence given by the inheritance hierarchy.
Proposal
Introduce an init block that calls super to initialize the fields of the direct superclass.
Example
Old version
class A(int x)
end
class B(int y)
end
main
B x = new B(0, 0)
end
Proposed syntax
class A(int x)
end
class B(int y)
init
super(y)
end
end
main
B x = new B(0);
end
Activity