C++でClass内のtypedefにもpublic, privateは適用される

タイトル通りだが、以下がサンプル。

テンプレートを使う時に重要になるのでメモ。

class Test {
private:
    typedef double private_real;

public:
    typedef double public_real;
};


int main(int argc, char const* argv[])
{   

    Test::public_real public_real = 1.0;
    //Test::private_real private_real = 2.0; //compile error
    
    return 0;
}