Q) Overloaded functions in C++ oops are
- Functions preceding with virtual keywords.
- Functions inherited from base class to derived class.
- Two or more functions having same name but different number of parameters or type.
- None of above
Answer: 3
Function overloading is compile time polymorphism in which 2 or more functions share the same name with different arguments and parameters in C++ oops.
Recommended to read function overloading in C++
NOTE: In C++, constructor is also a special type of function that can be overloaded. You can read advantage of constructor overloading in C++ applications.
Q) Correct way to declare pure virtual function in a C++ class is
- virtual void foo() =0 ;
- void virtual foo()= { 0 }
- virtual void foo() {} = 0;
- None
Answer: 1
A is the correct declaration of pure virtual function in a class in C++.
NOTE: Pure virtual function is used in an Interface or an abstract class.
Read details about C++ pure virtual function , C++ Interface and How to create abstract class in C++ program