Though a bit late, I just want to throw a couple of sents.
First, to explain about void, just you have quick look back at C.
C is a procedure-oriented language unlike C++.
C++ is object-oriented langauge. As it supercedes the C, it supports the c-style programming with procedures and functions etc.
The basic difference, a function returns a value and a procedure does not.
So how would you say you are writing a procedure to do something (may be a sequence of operations) but dont expect a value in return, like swap(a, b). It swaps the values of a and b vice versa but does not give back any explicit return code/value.
Where as the function pow(a,b) returns a value showing the power a^b, and can be used in of your any arithmatic expressions.
So, a chunk of code (ie, method) declared with return type 'void' is a procedure and other returns a value, is a function. In very simple terms.
And struct and class.
a structure is a group of data items declared and used in C style programming.
In addition to superceding the C and supporting the C-style programming, the C++ has its own version of object-oriented data types, such as a class supporting the encapsulization, polymorphism, inheritence, etc, etc.
In supportive to C++ style programming, the C provided 'struct' type is mould to look/act like a C++ class with simple differences like public by default (as it was in C).
The private, protected and public data properties are of object-oriented encapsulization concept and C is not built upon such concept. Hence a struct in C is just a group of data, but the same in C++, is a class-alike.
Since C++ built upon object-oriented concept and supports data inhertitence the :: (resolution) operation is provided to access those data members across the class hierarchy/family and its accessibility scope.
And finally, about construction and destruction, you have an earlier idea of same types, like
|
struct Student stu1, stu2, stu3;
|
In terms of C, you would say stu1, stu2 and stu3 are variables of one type, Student buti n terms C++, you would call the same as instances or objects.
Since there was no encapsulization concept in the struct type in C, you would not need to have a control of the construction and destruction of those struct variables.
But in C++, you may want to control the construction and destruction of a class you define what, when, and how. So the methods are provided for your control.
(When you dont provide one, the compiler would provide you one, a basic constructor and destructor.
You would know when you need one, an explicit constructor or destructor, to be defined. For instance the class has a pointer and it needs to be allocated every time an object of the class is created, and deallocated/released properly when the object is destroyed.
The same for copy constructor, = operator etc.)
For more details, you could look in a nice C++ reference for objects, constructors, destructors, etc. You would have a better and clear understanding of it.
Hope this helps. Good luck :)