zoukankan      html  css  js  c++  java
  • c++ arrow operator ,, –> Operator,,,指针专属 GIS

    C++ has an operator that can be used with a pointer to simplify the notation for
    specifying the members of a struct or a class. The arrow operator , -> , combines
    the actions of a dereferencing operator, * , and a dot operator to specify a member of
    a dynamic struct or class object that is pointed to by a given pointer. For example,
    suppose you have the following definition:
    struct Record
    {
    int number;
    char grade;
    };
    The following creates a dynamically allocated variable of type Record and sets the
    member variables of the dynamic struct variable to 2001 and 'A' .
    Record *p;
    p = new Record;
    p->number = 2001;
    p->grade = 'A';
    The notations
    p->grade
    and
    (*p).grade
    have the same meaning. However, the first is more convenient and is almost always the
    notation used.

  • 相关阅读:
    如何判断栈的增长方向
    时间复杂度
    shell基础part3
    shell基础part2
    shell基础part2
    linux基础part5
    linux基础part4
    linux基础part3
    linux基础part2
    shell基础part1
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/2746328.html
Copyright © 2011-2022 走看看