The description you gave is mostly correct but your examples don't show what you are describing.
A class describes a set of data members and member functions which can be called on those data members:
class Bow
{
public:
//Constructor
Bow::Bow()
{
arrows = 20;
}
Bow::Bow(int a)
{
arrows = a;
}
//member functions (in this case also called accessors/modifiers)
void getArrows(int a) const
{
return arrows;
}
void setArrows(int a)
{
arrows = a;
}
protected:
int arrows;
};
And an object of a class is simply an instance of that class.
//b and d are objects of the class Bow.
Bow b(3);//The constructor is automatically called here passing in 3
Bow d(4);//The constructor is automatically called here passing in 4
Bow e;//The constructor with no parameters is called and hence arrows = 20
Note: I purposely avoided the use of the word template that you used because it's used for something entirely different in C++ than what you meant.
To understand public/private/protected specifiers:
public: means that objects of the class can use the members directly.
protected: means that objects of the class cannot use the members directly. Derived classes that are based on that class can use the members.
private: means that objects of the class cannot use the members directly. Derived classes that are based on that class cannot use the members either.
So in the above example:
Bow b(3);
b.arrows = 10;//Compiling error arrows is not public so can't be accessed from an object