Previous Topic Next topic Print topic


COBCH1579 VALUETYPE cannot have an explicit parameter-less constructor

Within a valuetype, you must pass a parameter into a constructor method.

The following valuetype has two constructors. The first is parameter-less, and thus causes the error. The second example shows the correct syntax.

valuetype-id MyClassLibrary.MyValuetype1.
01 _powerlevel binary-long.
method-id new.
procedure division.  *> this is incorrect
  set _powerLevel to 0
end method.
 
method-id new.
procedure division using by value powerLevel as binary-long.  *> this is correct
  set _powerLevel to powerLevel
end method.
end valuetype.
Previous Topic Next topic Print topic