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>

  • 相关阅读:
    matlab colormap
    张量的基本概念
    河南省测绘资质单位大全
    Meanshift算法
    图形图像的绘制 GandyDraw
    leetcode
    Java 实现装饰(Decorator)模式
    Python
    Asp.Net+Easyui实现重大CRUD
    Scriptcase演示程序,现在,他们使用SC多么简单的开发系统
  • 原文地址:https://www.cnblogs.com/myself/p/1764700.html
Copyright © 2011-2022 走看看