Which type of function cannot be virtual in C++? 

  • Inline functions 
  • Constructor functions 
  • Friend functions 
  • Static member functions
Constructors in C++ cannot be virtual. When creating an instance of a derived class, it's essential to know the exact type of the object being created, so the correct constructor gets called. Making constructors virtual doesn't make sense in the context of object-oriented design, as it would introduce ambiguity in the object creation process.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *