I have always wondered why we code
virtual void MyFunction() = 0;
pure virtual void MyFunction();
Is there a reference for the basis of this decision?
From The Design and Evolution of C++ - Bjarne Stroustrup - Addison-Wesley (ISBN 0-201-54330-3) - chapter 13.2.3:
= 0syntax was chosen over the obvious alternative of introducing a new keyword
abstractbecause at the time I saw no chance of getting a new keyword accepted. Had I suggested
pure, Release 2.0 would have shipped without abstract classes. Given a choice between a nicer syntax and abstract classes, I chose abstract classes. Rather than risking delay and incurring the certain fights over
pure, I used the tradition C and C++ convention of using 0 to represent not there.
Anyway looking at the C++ standard (§ 9.2 - Class members)
= 0 is called pure-specifier.