jweinst1
4/27/2016 - 6:41 AM

string classes in c++

string classes in c++

#include <iostream>
using namespace std;

//C++ program that manipulates a string class and gets char
class StringObj {
public:
	string message;
	StringObj(string input) {
		message = input;
	}
	void printstring(){
		cout << message << endl;
	}
	char get(int key) {
		return message[key];
	}
};



int main() {
	StringObj lst("hello there");
	cout << lst.get(1) << endl;
	return 0;
}