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