Skip to content

Difference Quote by Scott Meyers

“A non-virtual function says, you have to do this and you must do it this way. A virtual function says you have to do this, but you don't have to do it this way. That's their fundamental difference.” quote by Scott Meyers
Download Open image
“A non-virtual function says, you have to do this and you must do it this way. A virtual function says you have to do this, but you don't have to do it this way. That's their fundamental difference.”

Scott Meyers

About This Quote

Source Book: Effective C++ by Scott Meyers, 2005

Non‑virtual functions enforce a specific implementation; virtual functions enforce an interface while allowing varied implementations.

In simple terms: Non‑virtual fixes code; virtual allows flexibility.

Key Takeaway

Choose virtual when behavior may vary.

Themes

programming design polymorphism

Mood

technical analytical

Type

educational technical

When to use this quote

  • software design
  • API design
  • framework development

Key Concepts

encapsulation inheritance interface

Questions to Reflect On

  • When should you prioritize flexibility over performance?
  • Do you need to change implementations later?
A Different Perspective

Virtual functions can introduce runtime overhead.

2.9 out of 5 (4 ratings)

More by Scott Meyers

Explore all 8 Scott Meyers quotes

More Difference quotes

Browse all 1,877 Difference quotes