#include #include "AClassT.h" using namespace std; AClassT::AClassT(){ } AClassT::AClassT(const AClassT & other){ if (other.data != nullptr) { data = new int; *data = *other.data; } else { data = nullptr; } value = other.value; } AClassT::~AClassT(){ if (data != nullptr) { delete data; } } AClassT & AClassT::operator =(const AClassT & other){ if (&other != this) { if (other.data != nullptr) { if (data == nullptr) { data = new int; } *data = *other.data; } else { data = nullptr; } value = other.value; } return *this; } void AClassT::Tell() const { cout << "\tThe value is " << value << endl; if (data != nullptr) { cout << "\tThe pointer is " << data << endl; cout << "\tThe data is " << *data << endl; } else { cout << "\tThe points is nullptr" << endl; } } bool AClassT::operator == (const AClassT & other) const { bool same{false}; if (value == other.value) { if (data == other.data) { same = true; cout << "The pointers are the same" << endl; } else if (data != nullptr and other.data != nullptr and *data == *other.data) { same = true; cout << "Data is the same, pointers are not" << endl; } } return same; } int AClassT::Data() const { if (data != nullptr) { return *data; } return 0; } void AClassT::Data(int d){ if (data == nullptr) { data = new int; } *data = d; } int AClassT::Value() const{ return value; } void AClassT::Value(int o){ value = o; }