I searched some post about virtual function declaration, which believed
=0
in
virtual void test()=0;
is fixed syntex so
virtual void test()=NULL;
virtual void test()=false;
virtual void test()=1-1;
virtual void test()=0.0;
and other declarations should not be valid.
but I found
virtual void test()=00;
virtual void test()=000;
virtual void test()=0000;
can also compile, why?
and also, I think integer +0 and -0 are actually same as 0 (I am not sure if it is right), just like 00 is actually 0, why
virtual void test()=+0;
and
virtual void test()=-0;
cannot compile?
From the November 2014 working draft of the standard:
10.4:
A virtual function is specified pure by using a pure-specifier (9.2) in the function declaration in the class definition.
In 9.2 we see the definition of a "pure-specifier":
pure-specifier: = 0
This shows that your examples should not compile, as you expect and as such you should file a bug report with your compiler manufacturer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With