对于 C++ 中引用的处理方式,我不太了解:
B objB = B();                   // Regular B object
const B &refConstObjB = objB;   // Reference to const B object
B* ptrB = new B();              // Regular pointer to B
B* const &refPtrConstB = ptrB;  // Reference to const pointer to B 
以上所有编译都很好。但是以下没有:
const B* &refConstPtrB = ptrB;  // Reference to pointer to const B
考虑到对象和指针都被声明为非常量,为什么我可以将对象引用为 const 对象,但不能对指针做同样的事情?