14 lines
231 B
C
14 lines
231 B
C
|
|
template<class T> class SmartPtr {
|
||
|
|
public:
|
||
|
|
SmartPtr(T *realPtr = 0) { pointee = realPtr; }
|
||
|
|
T *operator->() const {
|
||
|
|
return pointee;
|
||
|
|
}
|
||
|
|
T &operator*() const {
|
||
|
|
return *pointee;
|
||
|
|
}
|
||
|
|
private:
|
||
|
|
T *pointee;
|
||
|
|
};
|
||
|
|
|