ajwang / groovypptest

Automatically exported from code.google.com/p/groovypptest
0 stars 0 forks source link

Static method Polymorphism #394

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Do you known SmallTalk?

1.- in smalltalk this references the message (method) destinator.

    Object myInstance = new Object();
    myInstance.message() {
       // this: references to myInstance object
       // super: used to call instance methods from superclass 
     }

2.- in smalltalk every Class is instance of their MetaClass (class are 
instances)

   MyClass.staticMethod() {
      // this: reference MyClass
      // super: reference MyClass.getSuperClass()
   }

Currently Groovy language define this on static method as Class that define 
that method

   class MySubClass extends MyClass { ... }

   MySubClass.staticMethod() => this references allways to Myclass but must reference to MySubClass (the message destinator)

Original issue reported on code.google.com by jose.ill...@gmail.com on 10 Aug 2011 at 8:21