Auf Thema antworten

Findest Du? Eine Variable, deren Wert sich nicht verändern lässt, ist für mich eine Konstante :)


[code=C++]

#include<iostream>


class X {

public:

    const int value;


    X(int value) : value(value) {}

};


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

    X x(5);

    std::cout << x.value << std::endl;

    return 0;

}

[/code]


Da würde ich schon sagen, dass value eine Konstante ist.



Oben