Of course minutes after posting this I discovered I had a typo in my code. I am curious as to how others do it though. I'm new to JS.
It does appear to work after I grok'd this page: http://www.kevlindev.com/tutorials/javascript/inheritance/index.htm <snip> function Pin(opts) { this.setValues(opts); } Pin.prototype = new google.maps.Marker; // secret sauce from KevLinDev tutorial function extend(subClass, baseClass) { function inheritance() {} inheritance.prototype = baseClass.prototype; subClass.prototype = new inheritance(); subClass.prototype.constructor = subClass; subClass.baseConstructor = baseClass; subClass.superClass = baseClass.prototype; } function SubPin(opts) { SubPin.baseConstructor.call(this, opts); } SubPin.prototype = new Pin; extend(SubPin, Pin); var subPin = new SubPin({map: MAP, latlng: LATLNG}); </snip> On Aug 16, 12:03 pm, lycovian <[email protected]> wrote: > I've gotten simple inheritance working well by subclassing > google.maps.Marker. In my application would like to further > modularize the code if possible though and was wondering if anyone out > there had an example of multiple generations of subclasses of the > Marker object. > > I'm currently doing this: > Marker -> Pin > > But I would like to further extend this to: > Marker -> Pin -> SubclassPin > > I can't seem to call the Marker constructor from my SubclassPin. > > I realize this is a generic issue with Javascript and not Google's API > per se but I was hopeful that someone could point me to an example > that uses Google's v3 API as the generic examples I can find for > Javascript work well, and I think I understand them, but I haven't > been able to get any of them to work: > Prototype Framework:http://prototypejs.org/assets/2009/8/31/prototype.js > John Resig:http://ejohn.org/blog/simple-javascript-inheritance/ > Simple Example:http://www.webdeveloper.com/forum/showthread.php?t=165069 -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
