About UBullCowCartridge

while defining InitGame() , why we used
void UBullCowCartridge::InitGame()
instead of void InitGame()

Because otherwise you would be defining a non-member function.

class Example
{
    void Foo();
};

void Example::Foo()
{
    // Do something
}

void Foo()
{
    // Do something
}

int main()
{
    Example E;
    E.Foo(); // calls Example::Foo()
    Foo(); // calls Foo()
}

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms