Advanced C++ Concepts Quiz
3 Questions
0 Views

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

Which of the following statements about friend member functions in C++ is correct?

  • Friend member functions cannot be declared inside a class.
  • Friend member functions can only access public members of the class they are declared in.
  • Friend member functions can access private and protected members of any class.
  • Friend member functions can access private and protected members of the class they are declared in. (correct)
  • Which of the following statements about constructors and destructors in C++ is correct?

  • Constructors are called when an object is destroyed, while destructors are called when an object is created.
  • Constructors are called when an object is created, while destructors are called when an object is destroyed. (correct)
  • Constructors and destructors have the same name in C++.
  • Constructors and destructors cannot be overloaded in C++.
  • Which of the following statements about inheritance in C++ is correct?

  • Inheritance in C++ can only be public.
  • In single inheritance, a derived class can inherit from multiple base classes. (correct)
  • Inheritance in C++ is not supported by the language.
  • In multilevel inheritance, a class can inherit from itself.
  • More Like This

    Use Quizgecko on...
    Browser
    Browser