0
我正在阅读有关复制构造函数的内容。 任何机构可以告诉我什么是在下面的语句中发生复制构造函数的const对象
class Base {
public:
Base() {cout << "Base constructor";}
Base(const Base& a) {cout << "copy constructor with const arg";}
Base(Base& a) {cout << "copy constructor with non-const arg"; return a;}
const Base& operator=(Base &a) {cout << "assignment operator with non-const arg"; return a;}
}
void main()
{
Base a;
Base b = Base(); // This is neither calling copy constructor nor assignment operator.
}
请告诉我什么是在“基地B =基地()”语句发生。
它调用Base()吗? – user1227804 2012-02-28 12:56:32