Help us understand the problem. What is going on with this article?

C++のよくわからない記法

More than 1 year has passed since last update.

レビューで見たC++のよくわからない記法。

クラス名::を何個書いてもコンパイルが通る。

test.cpp
#include <iostream>

class A
{
public:
    static const int a = 0;
};

int main(void)
{
    std::cout << A::A::a << std::endl;
    // 何個も書ける
    std::cout << A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::A::a << std::endl;
    return 0;
}

いろいろ試してみたけど、だいたいコンパイルが通らなくて、
この記述方法ができて嬉しいことが見つからなかった。

e0232
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away