Guest User

Untitled

a guest
Apr 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <string>
  4. #include"RefCountPtrT.h"
  5.  
  6. using namespace std;
  7.  
  8. template <class T>
  9. RefCountPtrT<T>::RefCountPtrT(){
  10. ptr = NULL;
  11. }
  12.  
  13. template <class T>
  14. RefCountPtrT<T>::~RefCountPtrT(){
  15. //cout << "Destructor for ptr\n";
  16. }
  17.  
  18. template <class T>
  19. RefCountPtrT<T>::RefCountPtrT(RefCountPtrT & r){
  20. cout << "CC for ptr\n";
  21. }
  22.  
  23. template <class T>
  24. void RefCountPtrT<T>::operator=(RefCountPtrT & r){
  25. cout << "= for ptr\n";
  26. }
  27.  
  28. template <class T>
  29. void RefCountPtrT<T>::makeNull() {
  30. ptr = NULL;
  31. }
  32.  
  33.  
  34. template <class T>
  35. bool RefCountPtrT<T>::isNull() {
  36. if (ptr == NULL){
  37. return true;
  38. }
  39. else
  40. return false;
  41. }
  42.  
  43. template <class T>
  44. void RefCountPtrT<T>::allocNew() {
  45. ptr = new RefCountT<T>;
  46. };
  47.  
  48. template <class T>
  49. void RefCountPtrT<T>::setVal(T val) {
  50. ptr->setVal(val);
  51. }
  52.  
  53. template <class T>
  54. T RefCountPtrT<T>::getVal() {
  55. return ptr->getVal();
  56. }
Add Comment
Please, Sign In to add comment