[discuss] inaccurate description
kingFighter opened this issue · comments
Quote
Reference to const
There is no const reference because the reference itself is a const pointer
reference is NOT an object, that's the reason why NO reference itself is const.
// class
class A
{
private:
const int a; // constant object member, can only be assigned in the initialization list
};
// constant object member, can only be assigned in the initialization list
is not accurate, besides initialization list
, we can use in-class initializer
since C++11
// class
class A
{
private:
const int a=1; // constant object member, can only be assigned in the initialization list
};
It has been modified, thanks
Understand what functions C ++ silently writes and calls (the compiler secretly creates a default constructor, copy constructor, copy assignment operator, destructor for class)
C++11 secretly creates move constructor, move assignment operator
, above is true before C++11. Better to put comment about it.