Tag Archives: polymorphism

Virtual Destructors

Interview questions often ask about virtual destructors and why they are needed. It’s one of those funny things about C++ that unless you have specifically been shown, you just might not realise you need to know. So why do you need a virtual destructor? Essentially, you need a virtual destructor to make sure that ALL […]

Eclipse-CDT: Base class ” not in include paths for current project

Don’t you just hate weird things like this? You have a nice little project in Eclipse, it’s all is working fine, auto-complete, build, everything. BUT: When you try to add a new class using the File -> New -> Class menu, you get this error: Base class ‘myclassname’ not in include paths for current project. […]

Polymorphism and Overloading in C++

A reader sent me an interesting question the other day. They¬†asked if polymorphism and overloading were essentially the same thing. My initial reaction was Huh? What are people being taught if they think that these two concepts are the same thing? But a quick google search revealed that yes, many, many people are struggling to […]

Polymorphism Example in C++

If you’ve read my 5 minute guide What Is Polymorphism? and want to see it in action, here’s some C++ code that illustrates the example I mentioned in that post. I’ve kept the code to header files only for brevity, but as you well know, in the real world, objects would be split out into […]