Q. Which of the following is the correct syntax for defining a pure virtual function in C++?

  • (A) virtual void show() = 0;
  • (B) void show() = 0;
  • (C) virtual void show();
  • (D) abstract void show();
πŸ’¬ Discuss
βœ… Correct Answer: (A) virtual void show() = 0;
Explanation: A pure virtual function is declared using 'virtual' followed by '= 0'.
Explanation by: Ram Sharma
A pure virtual function is declared using 'virtual' followed by '= 0'.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
148
Total Visits
πŸ“½οΈ
2 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
86%
Success Rate