geeksforgeeks 019-c++中的static成员函数

  1. static成员函数没有this指针

    1
    2
    3
    4
    5
    6
    #include<iostream>
    class Test {
    static Test * () {
    return this;
    }
    };
  2. 不可以是虚函数

  3. 拥有相同名称和参数类型列表的两个成员函数不能被重载,如果其中一个是static成员函数

    1
    2
    3
    4
    5
    #include<iostream>
    class Test {
    static void () {}
    void () {}
    };
  4. 不可以被声明为const,volatile,const volatile

    1
    2
    3
    4
    5
    6
    #include<iostream>
    class Test {
    static void () const {
    return;
    }
    };