I am working on a project which has a class inheritance scheme like this:
Drive
|
v
FileDrive
|
v
StreamDrive
|
v
BufferStreamDrive_base
|
v
BufferStreamDrive
In Drive there is a virtual method declared like this:
virtual Drive::Type GetDriveType(void) const = 0;
Then in FileDrive it is overridden with this:
virtual Drive::Type GetDriveType(void) const;
with the following implementation:
Drive::Type
FileDrive::GetDriveType(void) const
{
return Drive::FILEDRIVE;
}
However, when I compile the code I get an error like this:
libtool: compile: x86_64-w64-mingw32.shared-g++ -DHAVE_CONFIG_H -I. -I../../include -I../../include -I./../../include -I./../../libraries/libmbc -I./../../libraries/libmbutil -I./../../libraries/libmbmath -I./../../libraries/libmbwrap -I./../../libraries/libann -I./../../mbdyn -I./../../mbdyn/base -I./../../mbdyn/struct -I./../../mbdyn/aero -I./../../mbdyn/elec -I./../../mbdyn/thermo -I./../../mbdyn/hydr -I./../../modules -I/opt/mxe/usr/x86_64-w64-mingw32.static/include/suitesparse -std=c++11 -D_USE_MATH_DEFINES -pthread -MT constltp_impl.lo -MD -MP -MF .deps/constltp_impl.Tpo -c constltp_impl.cc -DDLL_EXPORT -DPIC -o .libs/constltp_impl.o
In file included from dataman.h:43:0,
from bufferstreamdrive.cc:36:
bufferstreamdrive.cc: In function 'Drive* ReadBufferStreamDrive(const DataManager*, MBDynParser&, unsigned int)':
bufferstreamdrive.cc:291:21: error: invalid new-expression of abstract class type 'BufferStreamDrive'
InputEvery, pSDE));
^
./../../libraries/libmbutil/mynewmem.h:658:14: note: in definition of macro 'SAFENEWWITHCONSTRUCTOR_'
(pnt) = new constructor
^
bufferstreamdrive.cc:287:3: note: in expansion of macro 'SAFENEWWITHCONSTRUCTOR'
SAFENEWWITHCONSTRUCTOR(pDr, BufferStreamDrive,
^
In file included from bufferstreamdrive.cc:39:0:
bufferstreamdrive.h:68:7: note: because the following virtual functions are pure within 'BufferStreamDrive':
class BufferStreamDrive : public BufferStreamDrive_base {
^
In file included from tpldrive.h:35:0,
from rbk.h:38,
from reffrm.h:44,
from mbpar.h:110,
from dataman.h:47,
from bufferstreamdrive.cc:36:
drive.h:117:22: note: virtual Drive::Type Drive::GetDriveType() const
virtual Drive::Type GetDriveType(void) const = 0;
^
What is the problem here? I can't see it.
Aucun commentaire:
Enregistrer un commentaire