Ok, I need just a small example that defines a class that has public, private, and protected members. If I have a visual then I can better understand and write my own code. Any takers?
class human
{
public:
string askForName();
private:
string name;
};
string human::askForName()
{
return name;
}
I hope this is a good example of a class.
The name is private and another person who "talks" to this object needs to ask for name before he can know it. Basicly you just dont want some things to change things like name if they are not supposed to do it.
And if you think of it like a real world situation you cant change the name of another person right?