1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

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

Posted at

レビューで見た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;
}

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

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?