Giter VIP home page Giter VIP logo

record's People

Contributors

zhanghengxin avatar

Watchers

James Cloos avatar

record's Issues

w3 标准 之 form 表单

form 表单

from https://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2

Forms

A form is a template for a form data set and an associated method and action URI. A form data set is a sequence of name/value pair fields. The names are specified on the NAME attributes of form input elements, and the values are given initial values by various forms of markup and edited by the user. The resulting form data set is used to access an information service as a function of the action and method.

Forms elements can be mixed in with document structuring elements. For example, a PRE element may contain a FORM element, or a FORM element may contain lists which contain INPUT elements. This gives considerable flexibility in designing the layout of forms.

Form processing is a level 2 feature.

C++ 基础 之 运算符

运算符

范围解析运算符 ::

语法

:: identifier class-name :: indentifier namespace :: indentifier enum class :: indentifier enum struct :: identifier

备注

identifier 可以是变量、函数、枚举值

具有命名空间和类

以下示例显示范围解析运算符如何与命名空间和类一起使用

namespace NamespaceA{
  int x;
  class calss A {
    pulic:
      int x;
  };
}

int main(){
  // used to disambiguate
  NamespaceA::x = 1;
  NamespaceA::ClassA a1;
  a1.x = 2;
}

没有范围限定范围的范围解析运算符表示全局命名空间

namespace NamespaceA{
  int x;
}
int x;
int main(){
  int x;
  // the x in main()
  x=0;
  // the x in the global namespace
  ::x=1;
  // the x in the A namespaces
  NamespacesA::x=2;
}

你可以使用范围解析运算符标识命名空间的成员,还可标识通过using 指定成员的命名空间的命名空间。在下面的示例中,你可以使用NamespaceC 限定ClassB(尽管ClassB已在NamespaceB中声明),因为已通过using指令在NamespaceC中指定NamespaceB。

namespace NamespaceB{
  class ClassB{
    public:
      int x;
  };
}
namespace NamespaceC{
  using namespace B;
}
int main(){
  NamespaceB::ClassB c_b;
  NamespaceC::ClassB c_c;
  c_b.x=3;
  c_b.x=4;
}

可适用范围解析运算符链。在下例显示中,NamespaceD::NamespaceD1 将标识嵌套的命名空间NamespaceD1,并且NamespaceE::ClassE::ClassE1 将表示嵌套的类ClassE1

namespace NamespaceD{
  namespace NamespaceD1{
    int x;
  }
}
namespace NamespaceE{
  class ClassE{
    public:
      class ClassE1{
        public:
          int x;
      };
  };
}
int main(){
  NamespaceD::NamespaceD1::x=6; 
  NamespaceE::ClassE::ClassE1 e1;
  e1.x=7;
}

必须使用范围解析运算符来调用类的静态成员

class ClassG{
  pulic:
  static int get_x(){return x;}
  static int x;
};
int ClassG::x=6;
int main(){
  int gx1 = ClassG::x;
  int gx2 = ClassG::get_x();
}

区分范围的解析运算符还可以区分范围的枚举声明的值一起使用

enum class EnumA{
  First,
  Second,
  Third
};
int main(){
  EnumA enum_value = EnumA::First;
}

new 运算符

解释

原文:Allocates memory for an object or array of objects of type-name from the free store and returns a suitably typed, nonzero pointer to the object.
为对象、type-name类型的数组对象分配空闲的内存,并返回一个适合类型、非空的指针指向这个对象
从自由存储中为type-name 的对象或对象数组分配内存

语法

[::] new [placement] new-type-name [new-initializer]
[::] new [placement] (type-name) [new-initializer]

备注

如果不成功,则new 将返回零或者引发异常;参阅文档
》》 通过调用_set_new_handler 运行库函数,可更改此默认行为

如何在托管堆上创建对象信息 gcnew ???
使用new 为C++ 类对象分配内存时,将在分配内存后调用对象的构造函数,
使用delete 运算符可以解除分配使用的new 运算符,

以下示例分配后释放一个二维字符数组,数组大小为dim X 10.在分配多维数组时,出第一个纬度之外的所有纬度,必须是计算结果为正值的产量表达式;最左侧的数组纬度可以是计算结果为正值的任何表达式。在使用new 运算符分配数组时,第一个纬度为零,- new 运算符将返回一个唯一的指针

char (*pchar)[10] = new char[dim][10];
delete [] pchar

type-name 不可能为const、volatile\类声明、枚举声明,因此,以下示例是违法的

volatile char *vch = new volatile char[20];

new 运算符不会分配应用类型,因为他们不是对象
new运算符无法分配函数,但可用于分配指向函数的指针。

下面示例为返回整数的函数分配后释放一个包含7个指针的数组

int (**p) () = new (int (*[7]) ());
delete *p;

如果使用不带任何参数的new 运算符,并用/GX、/EHa、/EHs 选项进行编译,则编译器将在构造函数引发异常时生成的代码来调用运算符 delete

以下是new 语法元素
placement 如果重载new ,则提供一个传递附加参数的方式
type-name 分配的类型,可以是内置类型、也可以是用户定义类型,如果类型规范非常复杂,则可用括号将其括起来以强制实施绑定顺序。
initializer 初始化对象提供值,不能为数组指定初始设定项。仅但类具有默认构造函数时,new 运算符才会创建对象数组。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.