Skip to content

Instantly share code, notes, and snippets.

@adurpas
Created December 2, 2012 18:29
Show Gist options
  • Save adurpas/4190336 to your computer and use it in GitHub Desktop.
Save adurpas/4190336 to your computer and use it in GitHub Desktop.
// ISU laboratory session #9, exercise #2.
#include <iostream>
#include <string>
using namespace std;
class SmartString
{
friend ostream& operator<<(ostream& os, const SmartString& ss);
public:
SmartString(string* str);
~SmartString();
string* get();
string* operator->();
string& operator*();
SmartString(const SmartString& other);
SmartString& operator=(const SmartString& other);
private:
string* str_;
unsigned int* counter_;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment