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
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
The text was updated successfully, but these errors were encountered:
Current status
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
Proposed syntax
The text was updated successfully, but these errors were encountered: