C++ Programming - Objects and Classes

Exercise : Objects and Classes - General Questions
21.
Which of the following can be overloaded?
Object
Functions
Operators
Both B and C
Answer: Option
Explanation:
No answer description is available. Let's discuss.

22.
Which of the following means "The use of an object of one class in definition of another class"?
Encapsulation
Inheritance
Composition
Abstraction
Answer: Option
Explanation:
No answer description is available. Let's discuss.

23.
Which of the following is the only technical difference between structures and classes in C++?
Member function and data are by default protected in structures but private in classes.
Member function and data are by default private in structures but public in classes.
Member function and data are by default public in structures but private in classes.
Member function and data are by default public in structures but protected in classes.
Answer: Option
Explanation:
No answer description is available. Let's discuss.

24.
Which of the following statements is correct about the program given below?
class Bix
{
    public:
    static void MyFunction();
};
int main()
{
    void(*ptr)() = &Bix::MyFunction;
    return 0; 
}
The program reports an error as pointer to member function cannot be defined outside the definition of class.
The program reports an error as pointer to static member function cannot be defined.
The program reports an error as pointer to member function cannot be defined without object.
The program reports linker error.
Answer: Option
Explanation:
No answer description is available. Let's discuss.

25.
Which of the following statements are correct for a static member function?
  1. It can access only other static members of its class.
  2. It can be called using the class name, instead of objects.
Only 1 is correct.
Only 2 is correct.
Both 1 and 2 are correct.
Both 1 and 2 are incorrect.
Answer: Option
Explanation:
No answer description is available. Let's discuss.