HyperEngineer
Programmer
I have the following code:
This is in a .cpp file that instantiates the class.
I get this error:
VT100TermDlg.cpp(195) : error C2259: 'CVT100Port' : cannot instantiate abstract class due to following members:
vt100port.h(14) : see declaration of 'CVT100Port'
This is the declaration of the base class (which is a derived class from another derived class)in the .h file:
This is the implementation in the .cpp file:
The class that this is derived from is declared in another .h file:
And this is the implementation in the .cpp file:
I've run out of things to try. But it seems I'm missing something basic. Thanks for the help.
HyperEngineer
If it ain't broke, it probably needs improvement.
This is in a .cpp file that instantiates the class.
Code:
int port_number = 1;
unsigned int input_buffer_size = 4096;
unsigned int output_buffer_size = 1024;
long baud_rate = 9600;
char parity = 'N';
int word_size = 8;
int stop_bits = 1;
int dtr = SET;
int rts = RESET;
int xon_xoff = DISABLE;
int rts_cts = DISABLE;
int dtr_dsr = DISABLE;
m_pVTTermPort = new CVT100Port(this->m_hWnd,
port_number,
input_buffer_size,
output_buffer_size,
baud_rate,
parity,
word_size,
stop_bits,
dtr,
rts,
xon_xoff,
rts_cts,
dtr_dsr);
I get this error:
VT100TermDlg.cpp(195) : error C2259: 'CVT100Port' : cannot instantiate abstract class due to following members:
vt100port.h(14) : see declaration of 'CVT100Port'
This is the declaration of the base class (which is a derived class from another derived class)in the .h file:
Code:
class CVT100Port : public CWin32Port
{
public:
CVT100Port(HWND notify_window,
int port_number,
unsigned int input_buffer_size = 4096,
unsigned int output_buffer_size = 1024,
long baud_rate = UNCHANGED,
char parity = UNCHANGED,
int word_length = UNCHANGED,
int stop_bits = UNCHANGED,
int dtr = SET,
int rts = RESET,
int xon_xoff = DISABLE,
int rts_ctr = DISABLE,
int dtr_dsr = DISABLE);
virtual ~CVT100Port();
protected:
void TxNotify();
void RxNotify(int byte_count);
const HWND m_hNotifyWindow;
};
This is the implementation in the .cpp file:
Code:
CVT100Port::CVT100Port(HWND notify_window,
int port_number,
unsigned int input_buffer_size,
unsigned int output_buffer_size,
long baud_rate,
char parity,
int word_length,
int stop_bits,
int dtr,
int rts,
int xon_xoff,
int rts_cts,
int dtr_dsr): CWin32Port(port_number,
input_buffer_size,
output_buffer_size,
baud_rate,
parity,
word_length,
stop_bits,
dtr,
rts,
xon_xoff,
rts_cts,
dtr_dsr),
m_hNotifyWindow(notify_window)
{
}
The class that this is derived from is declared in another .h file:
Code:
CWin32Port(int port_number,
unsigned int InputBufferSize = 2048,
unsigned int OutputBufferSize = 2048,
long baud_rate = UNCHANGED,
char parity = UNCHANGED,
int word_length = UNCHANGED,
int stop_bits = UNCHANGED,
int dtr = SET,
int rts = RESET,
int xon_xoff = DISABLE,
int rts_cts = DISABLE,
int dtr_dsr = DISABLE);
And this is the implementation in the .cpp file:
Code:
CWin32Port::CWin32Port(int port_number, // 1,2,3 etc.
unsigned int InputBufferSize, // 2048
unsigned int OutputBufferSize, // 2048
long baud_rate, // UNCHANGED
char parity, // UNCHANGED
int word_length, // UNCHANGED
int stop_bits, // UNCHANGED
int dtr, // SET
int rts, // RESET
int xon_xoff, // DISABLE
int rts_cts, // DISABLE
int dtr_dsr // DISABLE
) : m_TxQueue(OutputBufferSize),
m_RxQueue(InputBufferSize)
{
}
I've run out of things to try. But it seems I'm missing something basic. Thanks for the help.
HyperEngineer
If it ain't broke, it probably needs improvement.