The virtual-functions tag has no usage guidance.
26
votes
1answer
2k views
Why does C++ not have a “pure” keyword for virtual functions?
I have always wondered why we code
virtual void MyFunction() = 0;
and not
pure virtual void MyFunction();
Is there a reference for the basis of this decision?
15
votes
7answers
2k views
When NOT to use virtual destructors?
I believed I searched many times about virtual destructors, most mention the purpose of virtual destructors, and why you need virtual destructors. Also I think in most cases destructors need to be ...
1
vote
1answer
67 views
Pass data into a constructor or instead create virtual methods?
In an object oriented module describing a database, should I pass DB description data structures to the constructor in the constructors of derived classes, or should I instead create ("virtual" that ...
1
vote
1answer
61 views
Virtual method returning a unique collection - how to ensure and hint?
I have a virtual method that returns a collection of items that must be unique. I want to make sure that it will be obvious when overriding the method. What is the best way to do this?
Here is an ...