<br><br>On Wednesday, February 15, 2012, Armin Burger &lt;<a href="mailto:armin.burger@gmx.net">armin.burger@gmx.net</a>&gt; wrote:<br>&gt; Hi all<br>&gt;<br>&gt; I would like to overwrite and extend the &quot;initialize&quot; function of a class. For all other functions I used the method via<br>
&gt;<br>&gt; OpenLayers.My_CLASS.prototype.funtionToOverWrite = function() {<br>&gt;<br>&gt; but in the case of the initialize function this does not show any effect (it is not used). OL version used is 2.11<br>&gt;<br>&gt; In addition I would not like to completely rewrite the function but extend it. I mean, calling the original function and then adding a few lines of code afterwards. Is this possible? If I create a new class inheriting from another I just can call the parent class like<br>
&gt;<br>&gt; OpenLayers.Control.Parent_Class.prototype.initialize.functionToExtend(this,...);<br>&gt;<br>&gt; and add my code afterwards. But this does not work when modifying an existing class.<br>&gt;<br>&gt; Any ideas how to achieve these goals?<br>
&gt;<br>&gt; Thanks in advance for any hints<br><br>The overwrite function and its associated test functions in the IGN section of the Class tests may help you. See &lt;<a href="https://github.com/openlayers/openlayers/blob/master/tests/BaseTypes/Class.html">https://github.com/openlayers/openlayers/blob/master/tests/BaseTypes/Class.html</a>&gt;<br>
<br>-- <br>Eric Lemoine<br><br>Camptocamp France SAS<br>Savoie Technolac, BP 352<br>73377 Le Bourget du Lac, Cedex<br><br>Tel : 00 33 4 79 44 44 96<br>Mail : <a href="mailto:eric.lemoine@camptocamp.com">eric.lemoine@camptocamp.com</a><br>
<a href="http://www.camptocamp.com">http://www.camptocamp.com</a><br><br>