28 lines
448 B
C++

#ifndef NALOGA0901_SMARTPOINTER_H
#define NALOGA0901_SMARTPOINTER_H
template<typename T>
class SmartPointer {
private:
T *pointer;
public:
SmartPointer() = default;
SmartPointer(T *pDate) : pointer(pDate) {}
~SmartPointer() {
delete pointer;
}
T &operator*() {
return *pointer;
}
T *operator->() {
return pointer;
}
};
#endif //NALOGA0901_SMARTPOINTER_H