← Quiz: C++ Interview Questions: all 10 questions
Quiz: C++ Interview Questions · Question 6 of 10
What is the difference between overloading and overriding?
What is the difference between overloading and overriding?
- A.They are two names for the same thing
- B.Overloading: same name, different parameters, chosen at compile time; overriding: a derived class redefines a virtual function, chosen at run time
- C.Overloading only applies to operators
- D.Overriding happens in the same class
Answer & explanation
Correct answer: Overloading: same name, different parameters, chosen at compile time; overriding: a derived class redefines a virtual function, chosen at run time
Overloading is compile-time polymorphism; overriding a virtual function is run-time polymorphism.
Can you get the rest right without peeking?
Take the timed Quiz: C++ Interview Questions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →