- default : Compiler가 자동으로 생성하도록 명시적으로 지정
- delete : Compiler가 자동으로 생성하지 않도록 명시적으로 지정
또는 해당 형식으로 함수가 동작하지 않도록 명시적으로 지정
| class Test1 
{ 
public : 
    Test1() = default;Test1(const Test1&) = default; ~Test1() = default; Test1& operator=(const Test1&) = delete; // = 연산자를 허용하지 않겠다. void f(int i) { std::cout << i << std::endl; } void f(double d) = delete; // double 로 전달 받는 것을 허용하지 않겠다. 
}; 
Test1 t, t1, t2; 
t.f(11); 
t.f(11.0); // Compile error : attempting to reference a deleted function 
t1 = t2;   // Compile error : attempting to reference a deleted function 
 | 
댓글 없음:
댓글 쓰기