effective c++ 썸네일형 리스트형 항목 26: 변수 정의는 늦출 수 있는 데까지 늦추는 근성을 발휘하자 변수(사용자 정의 타입) 정의시 지불하게 되는 비용 변수의 정의부에서 생성자 호출 비용 변수가 유효범위 벗어날 때 소멸자 호출 비용 정의된 변수의 미사용시 비용 //-------------------------- // 정의된 변수가 미사용되는 경우 (예외 발생시) // 1. 객체의 생성 비용 // 2. 객체의 소멸 비용 //-------------------------- std::string encryptPassword( const std::string& password ) { using namespace std; string encrypted; if (password.length() < MinimumPasswordLength) { throw logic_error("Password is too short.. 더보기 이전 1 다음