Difference between virtual and abstract methods [duplicate]

This question already has answers here: What is the difference between an abstract method and a virtual method? (28 answers) Closed 4 years ago. Here is some code from MSDN: // compile with: /target:library public class D { public virtual void DoWork(int i) { // Original implementation. } } public abstract class E : D … Read more

Why do we need virtual functions in C++?

I’m learning C++ and I’m just getting into virtual functions. From what I’ve read (in the book and online), virtual functions are functions in the base class that you can override in derived classes. But earlier in the book, when learning about basic inheritance, I was able to override base functions in derived classes without … Read more