baramin: (Default)
[personal profile] baramin
You can take the address of a static member if (and only if) it has an out-of-class definition:

class AE {
    // ...
public:
    static const int c6 = 7;
    static const int c7 = 31;
};

const int AE::c7;    // definition

int f()
{
    const int* p1 = &AE::c6;    // error: c6 not an lvalue
    const int* p2 = &AE::c7;    // ok
    // ...
}

(с) http://www.stroustrup.com/bs_faq2.html
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

March 2017

S M T W T F S
   1234
567 891011
12131415161718
19202122232425
262728293031 

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 11th, 2025 05:05 am
Powered by Dreamwidth Studios