I have a dynamic class. I would like to be able to attempt to access properties and methods on that class, and if they do not exist, I want the Class to handle the problem in a specific way, rather than throw an exception.
Thsi needs to be done internally to the class, not with an external "try" clause. In some languages this is known as a __resolve function.
thus
[CODE=javascript]var foo = new MyClass()
function MyClass(){
this.dog = "woof"
function __resolve(e) {
alert("I don't know what a" + e + "is");
}
}
alert(foo.dog) // woof
foo.cat() // I don't know what a cat is[/CODE]
Is this possible?
Thsi needs to be done internally to the class, not with an external "try" clause. In some languages this is known as a __resolve function.
thus
[CODE=javascript]var foo = new MyClass()
function MyClass(){
this.dog = "woof"
function __resolve(e) {
alert("I don't know what a" + e + "is");
}
}
alert(foo.dog) // woof
foo.cat() // I don't know what a cat is[/CODE]
Is this possible?
Comment