I'm trying to make a template class. It seems to be ok, but when I try to create a pointer to myclass' object, a core dumped error occurs.

```
#include <iostream>
#include <stdlib.h>

template <typename T>
class vec {
private:
    T* m_pnt;
    int m_dim;

public:
    vec();
    vec(int);
    ~vec();

    void prnt();
    void reduce(int);
    void null();

    void set(int, T);
    void print();
};

template <typename T>
vec<T>::vec() {
    m_dim = 100;
    m_pnt = (T*)calloc(100, sizeof(T));
    std::cout << "building without par" << std::endl;
}

template <typename T>
vec<T>::vec(int n) {
    m_dim = n;
    m_pnt = (T*)calloc(m_dim, sizeof(T));
    std::cout << "building" << std::endl;
}

template <typename T>
vec<T>::~vec() {
    free(m_pnt);
    std::cout << "killed" << std::endl;
}

template <typename T>
void vec<T>::reduce(int dim) {
    std::cout << "reduce" << std::endl;
    if (dim <= m_dim) {
        m_dim = dim;
        T* p = (T*)calloc(m_dim, sizeof(T));
        for (int i = 0; i != m_dim; i++)
            *(p + i) = *(m_pnt + i);

        free(m_pnt);

        m_pnt = p;
    } else {
        std::cout << "error: rowvector not valid dimension" << std::endl;
        throw;
    }
}

template <typename T>
void vec<T>::set(int idx, T val) {
    if (idx >= 1 && idx <= m_dim)
        *(m_pnt + idx - 1) = val;
    else {
        std::cout << "error: rowvector not valid index" << std::endl;
        throw;
    }
}

template <typename T>
void vec<T>::prnt() {
    for (int i = 0; i != m_dim; i++)
        std::cout << i + 1 << "\t" << m_pnt + i << "\t" << *(m_pnt + i)
                  << std::endl;
}

template <typename T>
void vec<T>::null() {
    for (int i = 1; i <= m_dim; i++)
        *(m_pnt + i - 1) = T(0);
}

int main() {
    vec<int>* d;
    std::cout << "d: " << d << std::endl;
    d->prnt();

    return 0;
}

```

There are no error in compiling, but the final output is something like

```
    d: 0
    segmentation fault (core dumped)

```