생성자
-
생성자 초기화, explicitC++/Common 2023. 10. 5. 00:02
생성자 관련해서 다른언어와 거의 같았다면 흘려보고 말생각 이었는데 생각보다 C++는 문법적으로 제 생각보다 더 다양한 부분이 있어서 오늘도 정리하게 되었습니다. 생성자 초기화 주의사항 #include using namespace std; class Position { public: Position() : _x(10), _y(10) { Print(); } Position(int n) : _x(n),_y(n) { Print(); } void Print() { cout