www.digitalmars.com         C & C++   DMDScript  

c++ - template virtual member functions

reply Richard <fractal clark.net> writes:
generally in the 9.3.1 area..

template <class T> struct A {

virtual void vfn() = 0;

void fn() { vfn(); }

};

void main() {

A<int> a;

a.fn();

}

Compiles without error (??) and generates a protection fault when run.

Richard
Jan 04 2003
parent "Walter" <walter digitalmars.com> writes:
It should generate a compile error. I'll add it to the list to be
fixed. -Walter

"Richard" <fractal clark.net> wrote in message
news:av7apf$se7$1 digitaldaemon.com...
 generally in the 9.3.1 area..

 template <class T> struct A {

 virtual void vfn() = 0;

 void fn() { vfn(); }

 };

 void main() {

 A<int> a;

 a.fn();

 }

 Compiles without error (??) and generates a protection fault when run.

 Richard

Jan 04 2003