This code utilizes inheritance where the child adds something to the scene that is declared in the parent. How can this be achieved without causing an error when trying to access the scene in the child level?
function Parent(domElement, renderStatistics) {
this.scene = new THREE.Scene();
}
function Child(domElement) {
Parent.call(this, domElement);
this.init();
}
Child.prototype = Object.create(Parent.prototype);
Child.prototype.constructor = Young;
Child.prototype.init = function () {
function createLab(geometry) {
var mesh = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial());
this.scene.add(mesh); // This causes an error: Cannot call method 'add' of undefined
}
}