1
我有一個名爲ErrorItem的類,它有多個構造函數。是否有可能在構造函數中調用另一個構造函數來管理默認值?多構造函數
例子:
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.
謝謝! 塞巴斯蒂安
使用此代碼,我得到編譯器錯誤:構造函數不能直接調用 –