zoukankan      html  css  js  c++  java
  • js学习类

    <script type="text/javascript">
                function Base(){
                //构造函数 类
                }
                //累成员
                Base.prototype.init=function(){
                    alert('Base hello');
                }
                //实例对象
                var bs=new Base();            
                //调用
                bs.init();
    </script>
    <script type="text/javascript">
                function Base(){//类
                    //成员方法
                    this.show = function(){ 
                        alert("Base show"); 
                    }; 
                    //成员方法
                    this.init = function(){ 
                        alert("Base init"); 
                    };
                }
                //实例对象
                var bs=new Base();            
                //调用
                bs.init();
    </script>
    <script type="text/javascript">
                function Base(){//类
                    
                }
                //成员方法
                Base.prototype.show = function(){ 
                    alert("ShapeBase show"); 
                }; 
                //成员方法
                Base.prototype.init = function(){ 
                    alert("ShapeBase init"); 
                };
                //静态方法 
                Base.StaticDraw = function(){ 
                    alert("method draw is static"); 
                } 
                //实例对象
                var bs=new Base();            
                //调用
                bs.init();
                //调用静态方法
                Base.StaticDraw();
    </script>
    

      附件下载

  • 相关阅读:
    设计模式
    工厂方法模式
    简单工厂模式
    tornado自定义Form组件
    tornado
    Tornado框架的知识系列
    Linux基本命令
    day2
    day1
    使用cp复制文件夹却不能打开
  • 原文地址:https://www.cnblogs.com/sntetwt/p/2992233.html
Copyright © 2011-2022 走看看