Method Overloading
- Last UpdatedOct 21, 2022
- 1 minute read
Two or more methods on an object may share the same name providing they have different arguments. This is called method overloading. PML will invoke the method with the arguments which match the method call. It is common practice:
-
To use a method with the same name as a member and one argument of the same type to set the member’s value. For example:
!Marvin.Answer(65)
-
To use a method of the same name as a member returning a value of the same type but with no arguments to get the member’s value. For example:
!Number = !Marvin.Answer()