1. <tt id="5hhch"><source id="5hhch"></source></tt>
    1. <xmp id="5hhch"></xmp>

  2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

    <rp id="5hhch"></rp>
        <dfn id="5hhch"></dfn>

      1. Javascript簡(jiǎn)單實(shí)現(xiàn)面向?qū)ο缶幊汤^承實(shí)例代碼

        時(shí)間:2020-11-18 18:18:41 JavaScript 我要投稿

        Javascript簡(jiǎn)單實(shí)現(xiàn)面向?qū)ο缶幊汤^承實(shí)例代碼

          復(fù)制代碼 代碼如下:

          function Polygon(iSliders){ //定義一個(gè)多邊形

          this.silders=iSliders;

          }

          Polygon.prototype.getArea=function(){ //為多邊形定義一個(gè)去的面積的.方法

          return 0;

          }

          function Triangle(iBase,iHeight){

          Polygon.call(this,3); //繼承多邊形對(duì)象

          this.base=iBase;

          this.height=iHeight;

          }

          Triangle.prototype.getArea=function(){ //重寫去的面積的方法

          return 0.5*this.base*this.height;

          }

          var triangle=new Triangle(15,8); //實(shí)例化一個(gè)三角形

          alert("邊數(shù):"+triangle.silders);

          alert("面積:"+triangle.getArea());

        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码

        1. <tt id="5hhch"><source id="5hhch"></source></tt>
          1. <xmp id="5hhch"></xmp>

        2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

          <rp id="5hhch"></rp>
              <dfn id="5hhch"></dfn>