zoukankan      html  css  js  c++  java
  • javascript面向对象编程(一)


    <script type="text/javascript">
            var test = {

                numA: 10,

                objB: {},

                arrC: [],

                init: function(){
                    alert(this.numA);
                },

                sayHi: function(name){
                    alert("hello " + name);
                },

                sayHelloWorld: function(){
                    this.sayHi("world");
                },

                get: function(){
                    
                    var self = this;
                    this.objB.alertNumA = function(){
                        alert(self.numA);
                    }

                }

            };

            var TestFunc = function(){
                
                alert("i'm testFunc");

            };

            TestFunc.prototype = {
                extFunc: function(){
                    alert("this extend function's numB is " + this.numB);
                },
                numB: 10
            };

            test.init();
            test.sayHi("qingming");
            test.sayHelloWorld();
            test.get();
            test.objB.alertNumA();

            var testFunc =  new TestFunc();
            testFunc.extFunc();
        </script>

  • 相关阅读:
    python之Lambda
    oracle数据处理之expdb/impdb
    oracle之dblink
    oracle数据处理之sql*loader(二)
    exsi主机之间使用scp拷贝文件超时问题
    exsi从磁盘中加载虚拟机
    exsi的虚拟机加载U盘
    python 中的property
    hp服务器安装exsi5.5
    关于vsphere的 许可证配置问题
  • 原文地址:https://www.cnblogs.com/myself/p/1764700.html
Copyright © 2011-2022 走看看