LANGUAGES | C++ | C++ INTERVIEW QUESTION AND ANSWERS | 04

C++ Interview

C++ Interview Question and Answers:

16. What is the difference between macro and iniine?
                Inline follows strict parameter type checking, macros do not.
Macros are always expanded by preprocessor, whereas compiler may or may not replace the inline definitions.

17. What is a scope resolution operator?
                The scope resolution operator permits a program to reference an identifier in the global scope that has been hidden by another identifier with the same name in the local scope.

18. How variable declaration in c++ differs that in c?
                C requires all the variables to be declared at the beginning of a scope but in c++ we can declare variables anywhere in the scope. This makes the programmer easier to understand because the variables are declared in the context of their use.

19. What is default constructor?
                A default constructor is a constructor that either has no parameters, or if it has parameters, all the parameters have default values.

20. What is the difference between Object and Instance?
                An instance of a user-defined type is called an object. We can instantiate many objects from one class.
An object is an instance of a class.

No comments:

Post a Comment