Instantiation

I’m still rather confused as to why I needed to instantiate fBullCowGame, nor how that command:

FBullCowGame BCGame;

in and of itself created an instance, why that instance was created where it was, rather than anywhere else…I just don’t really have a good grasp on it at all. I don’t think the instructor covered that topic as well as he could have. I googled for about 2 hours looking for youtube videos and c++ tutorials to try to figure out what was going on, but in the end end, I went with what he wrote and am moving on. Hopefully in future videos it becomes clear, because I’m just not picking it up.

I want to clarify that this is not a knock against this instructor particularly as every other site I’ve gone to has left me equally (sometimes more) confused/lost as this one has.

1 Like

Could it be like declaring it as a variable? Class: FBullCowGame Name: BCGame

1 Like

Hello @Bigheadface and dear Community,

at first, maybe this will help you:

Additionally, just go and inform you what the clear difference between “Instantiation” and “Initialization” is.

The line, where @sampattuzzi added the code FBullCowGame BCGame;, was fully random chosen. He could instantiate (and initiate) the BCGame object (objects are complex variables - this will be discussed later in this course) where ever in the file he want.

Kind regards
Kevin

I found an answer online about Instantiating and Initialization and used the BCGame for the example.

Instantiating

This is when memory is allocated for an object. This is what the BCGame is doing. A reference to the object that was created is returned from the BCGame.

Initialization

This is when values are put into the memory that was allocated. This is what the Constructor of a class does when using the BCGame.

Privacy & Terms