I have defined to class with virtual functions:
Then I defined another class that derived from them:
Now in the main I wrote:
But I get this error:
main.cpp: In function `int main(int, char**)':
main.cpp:11: error: cannot allocate an object of type `fifo'
main.cpp:11: error: because the following virtual functions are abstract:
fifo.h:6: error: virtual void write_if::reset ()
fifo.h:12: error: virtual int read_if::num_av ailable()
What should I do?
Code:
class A {
public:
virtual void write( char ) = 0;
virtual void reset() = 0;
};
class B {
public:
virtual void read( char & ) = 0;
virtual int num_available() = 0;
};
Code:
class fifo : public A, public B {
// some functions
}
Code:
fifo *afifo; afifo = new fifo;
main.cpp: In function `int main(int, char**)':
main.cpp:11: error: cannot allocate an object of type `fifo'
main.cpp:11: error: because the following virtual functions are abstract:
fifo.h:6: error: virtual void write_if::reset ()
fifo.h:12: error: virtual int read_if::num_av ailable()
What should I do?
Comment