Home / CSE / Object Oriented Programming Using C++ :: Discussion

Discussion :: Object Oriented Programming Using C++

  1. The #ifndef directive tests to see whether ________

  2. A.
    a class has been defined
    B.
    a variable has been given a value
    C.
    a class has no variable definitions
    D.
    any objects of the class have been instantiated

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    #ifndef checks whether the given token has been #defined earlier in the file or in an included file; if not, it includes the code between it and the closing #else or, if no #else is present, #endif statement. #ifndef is often used to make header files idempotent by defining a token once the file has been included and checking that the token was not set at the top of that file.


Be The First To Comment