KurtZ: Objektnotation: this oder prototype?

Beitrag lesen

Kurtz gegrüßt

So nicht, sondern so:

ja hab ich gerade auch eruiert ... : )

  
function meth3 () {  
  alert("meth3")  
}  
  
function cnst () {  
  
  function meth1 () {  
    alert("meth1")  
  }  
  
  this.meth1=meth1;  
  this.meth2=function () {alert("meth2")};  
  this.meth3=meth3;  
}  
  
a=new cnst();  
b=new cnst();  
  
alert(a.meth1==b.meth1); // false  
alert(a.meth2==b.meth2); // false  
alert(a.meth3==b.meth3); // true  
  
a.meth1();  
b.meth1();  

interessant in Perl werden geschachtelte Subs nur einmalig kompiliert ... hmm ...

Grüße
 Kurt