Hey, I am a Program goer and I just started to learn c++ last week. In the tutorial I'm reading, I find an example here:
So the line 10
The snippet【Test(): count(5){}】got me mad. I know it's used for assigning value 5 to the integer count. But could anyone tell me what what every【Test()】/【count(5){}】part of this is?
Testa
:b
counter(5)c
{}d
/*
a: defined as special function called a constructor, which can be used to initialize the object
b: this signifies that you are going to initialize some of the member variables
c: this is just specifying how to init the member variable "counter", kinda like counter = 5.
d: this is the function body of the constructor function.
*/