[Opengeoscience-developers] inheritance in geoweb
Aashish Chaudhary
aashish.chaudhary at kitware.com
Mon Oct 7 17:36:20 EDT 2013
Folks,
After emails from Ben, I am coming to this conclusion for our
implementation. Let me know if you are Ok with this or if you find any
major issue with this implementation.
- Aashish
// This is in use already
function inherit(C, P) {
"use strict";
var F = function() {
};
F.prototype = P.prototype;
C.prototype = new F();
C.uber = P.prototype;
C.prototype.constructor = C;
}
// Base class
var classA = function() {
var m_foo = 10;
this.print = function() {
console.log(m_foo);
};
this.setFoo = function(val) {
m_foo = val;
};
};
var classB = function() {
classA.call(this);
this.base_print = this.print;
this.print = function() {
// Call base class print for demonstration purposes only
this.base_print();
console.log('b');
};
};
inherit(classB, classA);
function init() {
var b = new classB();
b.setFoo(20);
b.print();
}
--
| Aashish Chaudhary
| R&D Engineer
| Kitware Inc.
| www.kitware.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/opengeoscience-developers/attachments/20131007/75bc789f/attachment.html>
More information about the Opengeoscience-developers
mailing list