Multiple Constructors
openedge, progress-4gl
Solution
Yes - the format is:
CONSTRUCTOR PUBLIC ErrorItem(variable list):
THIS-OBJECT(local variable list).
/* Stuff */
END CONSTRUCTOR.
Also the "THIS-OBJECT" call has to be the first statement in the constructor.
Problem
I have a class called ErrorItem that have multiple construtors. Is it possible to call another constructor inside of the constructor to manage default values? Example: ``` CONSTRUCTOR PUBLIC ErrorItem(): ErrorItem("", "", "", -1, "", ""). END CONSTRUCTOR. CONSTRUCTOR PUBLIC ErrorItem( ItemNo AS CHARACTER ,UpcCode AS CHARACTER ,CustomerPo AS CHARACTER ,ColumnId AS INTEGER ,Description AS CHARACTER): ErrorItem(ItemNo, UpcCode, CustomerPo, ColumnId, Description, ""). END CONSTRUCTOR. CONSTRUCTOR PUBLIC ErrorItem( ItemNo AS CHARACTER ,UpcCode AS CHARACTER ,CustomerPo AS CHARACTER ,ColumnId AS INTEGER ,Description AS CHARACTER ,Detail AS CHARACTER ): ASSIGN THIS-OBJECT:ItemNo = ItemNo THIS-OBJECT:UpcCode = UpcCode THIS-OBJECT:CustomerPo = CustomerPo THIS-OBJECT:ColumnId = ColumnId THIS-OBJECT:Description = Description THIS-OBJECT:Detail = Detail . END CONSTRUCTOR. ``` Thank you! Sebastien