non virtual interfaces
Alexandr Druzhinin
drug2004 at bk.ru
Thu Sep 19 21:43:05 PDT 2013
Hello all.
I try to use NVI and failed with a snippet from TDPL:
interface Transmogrifier
{
final void thereAndBack()
{
transmogrify();
untransmogrify();
}
private:
void transmogrify();
void untransmogrify();
}
class CardboardBox: Transmogrifier
{
override private void transmogrify() { }
override void untransmogrify() {}
}
int main()
{
auto cb = new CardboardBox();
return 0;
}
doesn't compile with log info:
src/test.d(16): Error: function test.CardboardBox.transmogrify cannot
override a non-virtual function
src/test.d(17): Error: function test.CardboardBox.untransmogrify does
not override any function, did you mean to override
'test.Transmogrifier.untransmogrify'?
It rather well differs from what I expected reading TDPL. Something is
changed very much or I just missed something?
More information about the Digitalmars-d-learn
mailing list