O2. Init = function(){ // how would I call my ancessors init()? Alert('o2'); o1.init(); }; Out of curiosity, was "ancessors" a spelling error for "ancestor’s" or does "ancessors" mean something specific here?
Did you mean o2’s "parent" object?
JavaScript functions are objects and have two useful methods to invoke the function: Function. Call(scope, arg1, ...) Function. Apply(scope, args) You can use one of these to call the parent implementation, explicitely passing this as the scope parameter, so that in the parent implementation, this refers to the child object: var o1 = { name : "One", init : function() { alert("o1: " + this.Name); } }; var o2 = Object.
Create(o1); o2. Name = "Two"; o2. Init = function() { o1.init.
Call(this); alert("o2: " + this name); }; This will alert: o1: Two and o2: Two.
I don't think this is entering into the spirit of the question, how would o2 be aware of the existance of the o1 variable. For any such attempt at object oriented development in Javascript to make sense you can't be having this sort of coupling. – AnthonyWJones Nov 1 '09 at 21:17 Of course you can.
If you want to call your prototype's method implementation, you have to know your prototype. This is similar to class inheritance in C++, where you have to know your parent class in order to call a overridden method (ParentClass::method()). – Ferdinand Beyer Nov 2 '09 at 8:52.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.