So I was following a tutorial on classes and function when I met this line of code that makes me question my understanding about this subject. Here is something that look like the code:
FBullCowGame BCGame;
std::string X
FBullsAndCows Count = BCGame.Counting(X);
Now based on my understanding, BCGame is an Object created with the scope of all of the FBullCowGame now what I can't understand is how Counting(X) can send the x value from this cpp file to the function located inside the FBullCowGame. Here's the question:
1) Can the function()
be used for more than just initializing the function? Like for this instance it seems sending the value of x to make it the function value.
2) Is my understanding of objects flawed or wrong?
3) If the function()
can be used for sending and receiving value, does it work like it's initialized the function and gets the value of the function? Or is this understanding wrong?