2017-05-22 2 views

답변

4

가 C에서 하나 이상의 파라미터 생성자를 갖는 것이 가능하다를 갖는 것이 가능하다 ++?

예.

예컨대 :

class square 
{ 
    int m_top; 
    int m_left; 
    int m_right; 
    int m_bottom; 
public: 
    // Constructor for case when all data is provided 
    square(int top, int left, int right, int bottom) : m_top(top), m_left(left), m_right(right), m_bottom(bottom) 
    { 
    } 
    // Constructor for case when some data is missing 
    square(int top, int left) : m_top(top), m_left(left), m_right(top+1), m_bottom(left+1) 
    { 
    } 
    // ... other members (like default constructor, getters, setters, etc.) 
}; 

과 이용이 가능 매개 변수와 소멸자을 가지고? 하지 옵션에서

번호

당신은 destrtuctor in C++ reference에 대한 몇 가지 옵션을 찾을 수 있지만, 이름과 서명 (매개 변수).