Polymorphism: Difference between revisions
Content added Content deleted
Line 2,287: | Line 2,287: | ||
We see polymorphism for print method (module in M2000), and for operator "=". Also Constructor in Circle read types of arguments and respond accordingly as programmed. In M2000 we can read arguments later, from stack of values, so we can check this stack. |
We see polymorphism for print method (module in M2000), and for operator "=". Also Constructor in Circle read types of arguments and respond accordingly as programmed. In M2000 we can read arguments later, from stack of values, so we can check this stack. |
||
0~ is single zero. So x, y and r get first value as single type, and stay that. Numeric types can be double (default, no symbol), Decimal (@),Currency(#),Long(&),Integer(%). For Strings we have to use $ in names, for variables and functions. There are groups which have both names, numeric and string, when they return string value. We can make a string property, and interpreter make a group which return/get string. We can add modules/functions to properties, using Group x {...}, inside a group definition (a class has a group definition also). |
|||
A Class: label direct interpreter to not include any after in the returned group, a float group, which return a Class function. |
|||
A class function is global by default, except in a class definition which is a member of group. |
|||
<lang M2000 Interpreter> |
<lang M2000 Interpreter> |
||
Class PointA { |
Class PointA { |