Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by whitelisting our website.

Cpp Programming

Cpp Programming 74 – What is correct about the static data member of a class?

Question: What is correct about the static data member of a class?
[A]. A static member function can access only static data members of a class.
[B]. A static data member is shared among all the object of the class.[C]. A static data member can be accessed directly from main().
[D]. Both A and B.

Answer: Option D

Cpp Programming 74 – What is correct about the static data member of a class? Read More »

Cpp Programming, OOPs Concepts

Cpp Programming 75 – What happens if the base and derived class contains definition of a function with same prototype?

Question: What happens if the base and derived class contains definition of a function with same prototype?
[A]. Compiler reports an error on compilation.
[B]. Only base class function will get called irrespective of object.[C]. Only derived class function will get called irrespective of object.
[D]. Base class object will call base class function and derived class object will call derived class function.

Answer: Option D

Cpp Programming 75 – What happens if the base and derived class contains definition of a function with same prototype? Read More »

Cpp Programming, OOPs Concepts

Cpp Programming 76 – Which of the following statements is correct in C++?

Question: Which of the following statements is correct in C++?
[A]. Classes cannot have data as protected members.
[B]. Structures can have functions as members.[C]. Class members are public by default.
[D]. Structure members are private by default.

Answer: Option B

Cpp Programming 76 – Which of the following statements is correct in C++? Read More »

Cpp Programming, OOPs Concepts