Constructor: when you declare a new object of that class, you invoke its constructor. The default constractor takes no arguments, and it should initilize that classes private members, so in your example:
Code:
dog(){
age = -1; /* these do not have to equal '-1' they could be your special default value */
weight = -1; /*it could be beneficial to set both to '-1' however as it will act as a flag */
your constructor could have parameters as well; lets say that before you make a new class object you ask the user for the age and weight of the dog, and they are 3 and 75 respectively, then your constructor might look like:
Code:
dog( int ageInput, int weightInput ){
age = ageInput; /* now the members of the class will be set to the user inputed values */
weight = weightInput;
}
you could also have just one parameter, age or weight...when the program is running it will match the proper constructor.
destructor: not used very widely anymore, but it is used for clean up when the object is deleted; lets say you dynamically allocate memory somewhere in you class, one place that you could deallocate it is inside the destructor.
void: your class could have any sort of function inside of it; this one is of type void...I'm not exactly sure what your question here is...
all the functions are declared in the class, and are defined below; the class declaration should be placed in a .h file, so dog.h and the definitions should be placed in dog.cpp
I suggest you do some research on google; there are TONS of great tutorials. Also pick up a book for Christ's sake.