Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
813 views
in Information Technology by (72.7k points)
closed by
Which of the following is false statement, about virtual functions in C++?
1. They must be members of some class
2. They cannot be static members
3. They are accessed using object pointers.
4. They cannot be a friend of another class.

1 Answer

0 votes
by (121k points)
selected by
 
Best answer
Correct Answer - Option 1 : They must be members of some class

A virtual function is a member function which is declared within a base class and is re-defined(Overriden) by a derived class. 

  • Virtual functions ensure that the correct function is called for an object, regardless of the type of reference (or pointer) used for function call.
  • Virtual functions must be members of the base class
  • They are mainly used to achieve Runtime polymorphism
  • Functions are declared with a virtual keyword in base class.
  • The resolving of function call is done at Run-time.
  • Virtual functions cannot be static and also cannot be a friend function of another class.
  • Virtual functions should be accessed using pointer or reference of base class type to achieve run time polymorphism.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...