Static Class
Monkey Forums/Monkey Programming/Static Class
| ||
How can I access the methods in a class without having to instanstiate the class? Example: Class testClass Method test Print "test" End End testClass.test() |
| ||
Instead of Method, use Function? |
| ||
Yep, no such thing as a method in an uninstantiated class. The whole point of a method is that it belongs to a specific instance. |
| ||
Compile Error Method 'save' cannot be accessed from here. So I guess you can't do this : Extern Class moofooLcst="moofooLcst" Function save( key$, data$) Method load$( key$ ) Method remove( key$ ) End Public Class lclst Extends moofooLcst Method New() End End lclst.save("test", "test") |
| ||
didn't throw up an error for me? |
| ||
Try it with the "Extern" Statement |
| ||
Ahh right, i'll bow out of this then, because im not sure what the Extern stuff is ;) |
| ||
Yeah I've got a feeling Extern stuff has got to be of type "Method" as it's actually calling a method in an external class and not standalone function :( Bummer! |