class tabBase
{
public:
tabBase() { }
virtual ~tabBase() { }
virtual void write() {}
virtual void read() {}
virtual void start() {}
virtual void stop() {}
virtual void connect() {}
virtual void disconnect() {}
virtual void openFile() {}
virtual void closeFile() {}
virtual void searchForText() {}
};
class tcpServerTab : public tabBase
{
public:
tcpServerTab() { /* ...code... */ }
virtual ~tcpServerTab() { /* ...code... */ }
virtual void write() { /* ...code... */ }
virtual void read() { /* ...code... */ }
virtual void start() { /* ...code... */ }
virtual void stop() { /* ...code... */ }
};
class tcpClientTab : public tabBase
{
public:
tcpClientTab() { /* ...code... */ }
virtual ~tcpClientTab() { /* ...code... */ }
virtual void write() { /* ...code... */ }
virtual void read() { /* ...code... */ }
virtual void start() { /* ...code... */ }
virtual void stop() { /* ...code... */ }
virtual void connect() { /* ...code... */ }
virtual void disconnect() { /* ...code... */ }
};
class plainTextTab : public tabBase
{
public:
plainTextTab() { /* ...code... */ }
virtual ~plainTextTab() { /* ...code... */ }
virtual void openFile() { /* ...code... */ }
virtual void closeFile() { /* ...code... */ }
virtual void searchForText() { /* ...code... */ }
};
像上面的例子一样,将所有可能的函数放置在基类中的任何派生类中是否存在或可能存在任何设计问题或不可预见的后果?