\n>>> class MyClass:\n... \tpass\n... \n>>> a = MyClass()\n>>> a.test()\nTraceback (most recent call last):\n File "<interactive input>", line 1, in ?\nAttributeError: MyClass instance has no attribute 'test'\n>>> def myMethod(self, name):\n... \tprint "Hi from " + name\n... \t\n>>> myMethod(a, "stand alone")\nHi from stand alone\n>>> MyClass.test = myMethod \n>>> a.test("a class")\nHi from a class\n
Can this be done in a method oriented language like Ruby?
Regards,
John