Skip to content

Instantly share code, notes, and snippets.

@adurpas
Created December 2, 2012 18:24
Show Gist options
  • Save adurpas/4190320 to your computer and use it in GitHub Desktop.
Save adurpas/4190320 to your computer and use it in GitHub Desktop.
// ISU laboratory session #9, exercise #1.
#include "SmartString.hpp"
SmartString::SmartString(std::string* str) : str_(str) {}
SmartString::~SmartString() // Delete string
{
delete str_;
cout << "Destructor: string deleted!";
}
std::string* SmartString::get()
{
return str_;
}
string* SmartString::operator->()
{
return str_;
}
string& SmartString::operator*()
{
return *str_;
}
SmartString::SmartString(const SmartString& other) // Copy constructor
{
// Nothing to do
}
void SmartString::operator=(const SmartString& other) //Assignment operator
{
// Nothing to do
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment