oop - What is adding methods to a class instead of "properly" subclassing called? -
take simple example in python:
>>> class a(object): ... pass ... >>> def f(self): ... print "f called" ... >>> a.f = f >>> = a() >>> a.f() f called so in example, existing class a gets additional (instance) function f (though overriding existing ones works well). in real life of course happen e.g. in different modules. how procedure called?
not sure following you, if do, talking extension methods
Comments
Post a Comment