単純なメソッド オーバーロードの例

class-id. A.
repository.
     Class sys-datetime as “System.DateTime”.
static.
Method-id. Main.
01 obj-any object.                        *> define an item of type System.Object
01 obj-string string.                     *> define an item of type System.String
01 obj-datetime sys-datetime.             *> define an item of type System.DateTime

    Invoke self::”Method1”                *> invokes variant 1
    Invoke self::”Method1”(obj-any)       *> invokes variant 2
    Invoke self::”Method1”(obj-string)    *> invokes variant 3
    Invoke self::”Method1”(obj-datetime)  *> invokes variant 2
*> Note that the last invoke maps onto variant 2 because an object of type
*> System.DateTime can be assigned to a System.Object but not to a System.String
End method main.
Method-id. Method1.    *> Variant 1 (no parameters)
Procedure division.
…
End method method1.
Method-id. Method1.    *> Variant 2 (object parameter)
Procedure division using by value o1 as object.
…
End method method1.
Method-id. Method1.    *> Variant 3 (string parameter)
Procedure division using by value o1 as string.
…
End method method1.
End static.
End class a.