C++
Empty (컴파일러가 자동생성하는 함수)
호타리
2023. 9. 1. 12:17
<main.cpp>
#include <iostream>
#include "empty.h"
int main()
{
Empty e1;
const Empty e2 = e1;
e1 = e2;
Empty *p1 = &e1; // e1.operator&()
const Empty *p2 = &e2; // e2.operator&()
return 0;
}
<empty.h>
#ifndef EMPTY_H
#define EMPTY_H
class Empty {
public:
//Empty() { }
//Empty(const Empty& rhs) { /* memberwise copy */ }
//~Empty() { }
//Empty& operator=(const Empty& rhs) { /* memberwise copy */ }
//Empty *operator&() { return this; }
//const Empty *operator&() const { return this; }
};
#endif