-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathString.h
More file actions
38 lines (33 loc) · 992 Bytes
/
String.h
File metadata and controls
38 lines (33 loc) · 992 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Define a variable length string class
// ECE4893/8893 Fall 2012
// George F. Riley
// First the "include guard
#ifndef __STRING_H__
#define __STRING_H__
#include <iostream>
class String
{
public:
String(); // Default constructor
String(const char* st); // Construct with initial string pointer
String(const String&); // Copy constructor
~String(); // Destructor
// Assignment operator
String& operator=(const String&);
// Access to char* variable
char* c_str() const;
static void ClearCounts(); // Clear the constructor/destructor counts
static void PrintCounts(); // Print the counts then clear
private:
char* st; // The actual string
public:
// Static counts
static int DefaultCount;
static int CreateCount;
static int CopyCount;
static int AssignCount;
static int DestructCount;
};
// Define a non-member printing function
std::ostream& operator<<(std::ostream&, const String& st);
#endif