---
# System prepended metadata

title: 解構式

---

# 解構式 
```
#include <iostream>
using namespace std;
class data
{
  public:
    data(int in)
    {
        ptr = &in;
    }
    ~data()
    {
        delete ptr;
    }
  private:
    int *ptr;
};
int main()
{
    data d1(10);
}
```