// @topic T070m11d07x10 class DString -- copy constructor, destructor, assignment op
// @brief class DString declaration
// DString.h
#ifndef DSTRING_H_INCLUDED
#define DSTRING_H_INCLUDED
#include <iostream>
class DString {
// friends of this class have access to all private members of this class:
friend std::ostream& operator<<( std::ostream& cout, DString const& str );
friend std::istream& operator>>( std::istream& cin, DString& str );
// data members
static const size_t INITIAL_CAPACITY = 1;
char* m_array;
size_t m_length; // logical length of the string
size_t m_capacity; // current capacity of the object
public:
// constructors, assignment, and destructor
DString();
DString( char const* pstr );
DString( DString const& another ); // copy constructor
DString const& operator=( DString const& another );
~DString();
// operations
size_t length() const;
size_t capacity() const;
void allocate( size_t capacity );
};//class DString
std::ostream& operator<<( std::ostream& cout, DString const& str );
std::istream& operator>>( std::istream& cin, DString& str );
#endif //DSTRING_H_INCLUDED