What will be printed out as a result of the following code execution?
#include <iostream>
const int SIZE = 5;
struct tester
    void foo()
        std::cout << SIZE << std::endl;

        SIZE = 3

int main(int argc, char** argv)
    tester t;
    return 0;
Since enum SIZE is defined inside the class, it "covers" the global variable within the class methods. More details: https://en.cppreference.com/w/cpp/language/lookup

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
C++ quizzes
Sign Up Now
or Subscribe for future quizzes