zoukankan      html  css  js  c++  java
  • 第6章 面向对象的程序设计(待完善)

    属性类型:

        数据属性--4大行为:[[Configurable]]

                  [[Enumerable]]

                  [[Writable]]

                  [[Value]]

             修改方法 obj.defineProperty(obj,"name",{

                  Configurable:false,

                  ....

                 })

        访问器属性--4大特性:[[Configurable]]

                   [[Enumerable]]

                   [[Get]]

                   [[Set]]

              

              定义方法 obj.defineProperty(obj,"name",{

                  Configurable:false,

                  ....

                 })

    定义多个属性:

    object.defineProperties(book,{

      _year:{

        value:2004

      },

      

      _edition:{

        value:1

      },

      

      year:{

        get:function(){

          return this._year;

        },

        set:function(newValue){

          if(newValue>2004){

            this._year = newValue;

            this._edition =+ newValue - 2004;

          }

        }

      },

    })

    读取属性的特性

      Object.getOwnPropertyDescriptor()

  • 相关阅读:
    搭建DG(data guard),及搭建过程中遇到的一些小问题 高伟
    介绍linux下vi命令的使用
    linux gcc编译器使用
    Linux进程编程介绍
    事件与接口实例讲解 C#
    Linux 2.6内核的编译步骤及模块的动态加载
    C# 各种定时器比较 zz
    linux下增加系统调用
    VirtualBox共享文件夹
    C++程序的单元测试(转贴)
  • 原文地址:https://www.cnblogs.com/alex-web/p/5000583.html
Copyright © 2011-2022 走看看