oop - What is adding methods to a class instead of "properly" subclassing called? -


take simple example in :

>>> 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

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

Laravel Bind Multiple Class to One Contract in The Service Provider -