Well, in general, I really think GetX() and SetX() are good ways for accessor functions. string is a bad name for anything, because it is a C++ classname. I usually have member variables prefixed with _ or m_.
Actually, that's not technically true; I usually make a struct that stores all my member variables, and hide the implementation that way, something like this:
Code:
MyClass.h
class CMyClass{
public:
/* Public interface */
protected:
/* Protected interface */
private:
/* Private helper functions */
struct Impl;
Impl * pImpl; // I usually actually use std::auto_ptr or boost::shared_ptr instead of a "naked pointer"
};
Code:
MyClass.cpp
struct CMyClass::Impl{
/* The class members go here */
};
/* Functions defined here */
This is the "PIMPL" idiom, and is widely used. It minimizes compile times (the entire implementation affects only one .CPP file) and it puts the entire interface in one file, the implementation details in another.