felix 12: klassenlose vollwertige und flexible oo auf funktionaler basis

Beitrag lesen

Nachtrag:

angenommen ich arbeite mit call, und ich überschreibe eine Funktion der "Klasse" die ich über call konstruiere, wie kann ich dann noch auf sie zugreifen? zb:

function SuperCat() {
  this.sound = "miaow";
}

function SubCat() {
  SuperCat.call(this);
  var instance = this;
  this.sound ="overridden miaow";

this.makesound = function() {
    alert("the cat says" + instance.sound);
  }
}

var felixcat = new SubCat();
felixcat.makesound();

wie rufe ich den member "sound" von der mit call erzeugten instanz der "Klasse" SuperCat auf? Ich meine wie referenziere ich diesen? geht das überhaupt?

Ich meine natürlich wie referenziere ich diesen aus SubCat heaus. Also, anstatt "alert("the cat says" + INSTANCE.sound);", sowas wie alert("the cat says" + SUPERCATINSTANCE.sound); //so das "miaow" herauskommt :)

Gruß Felix

0 45

Interne public static member nicht aufrufbar

felix12
  • javascript
  1. 0
    Cheatah
    1. 0
      felix12
      1. 0
        Cheatah
        1. 0
          felix12
          1. 0
            MudGuard
            1. 0
              felix12
              1. 0
                Struppi
                1. 0
                  Patrick Andrieu
                  1. 1
                    peterS.
                    1. 0
                      Patrick Andrieu
                    2. 0
                      felix12
                2. 1

                  *private static* durch umschliessende anonyme *function stacks*

                  peterS.
                  1. 0
                    felix12
                    1. 0
                      Struppi
                      1. 0
                        felix12
                        1. 2

                          klassenlose vollwertige und flexible oo auf funktionaler basis

                          peterS.
                          1. 0
                            felix12
                            1. 0
                              felix 12
                            2. 0
                              Struppi
                              1. 0
                                felix12
                            3. 1

                              vererbung / delegationsprinzipien

                              peterS.
                              1. 0
                                felixcat
                                1. 1

                                  »[Function].arguments.callee« versus »arguments.callee«

                                  peterS.
                                  1. 0
                                    felix12
      2. 0
        Kai345
        1. 0
          felix12
          1. 0
            ChrisB
            1. 0
              felix12
              1. 0
                Struppi
                1. 0
                  felix12
                  1. 0
                    Struppi
                    1. 0
                      felix12
                      1. 0
                        Struppi
                      2. 1

                        einfache objekte/namensraeume und singleton-konstrukte

                        peterS.
                        1. 0
                          Struppi
              2. 2
                Timo "God's Boss" Reitz
                1. 0
                  felix12
                  1. 0
                    Kai345
                    1. 0
                      felix12
                      1. 0
                        Kai345
                        1. 0
                          Kai345
                          1. 0
                            felix12
                            1. 0
                              Kai345
  2. 4
    molily