|
|
Home » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » Link error when using polymorphism
Link error when using polymorphism [message #15669] |
Sat, 03 May 2008 20:14  |
lucpolak
Messages: 18 Registered: April 2008 Location: France
|
Promising Member |
|
|
Hi all,
i'm Lucas and i'm new in using TheIDE. I have a problem.
I have an abstract class named DBConnector and a derived class MySqlConnector.
When compiling, all is ok but i always have the link error :
vtable for VirtualSofts::SQL::DBConnector(referenced from d:\ultimate++\out\easybat\mingw.debug_full.gui.main.noblitz\ erpsystem.o:290; .text$_ZN12VirtualSofts3SQL11DBConnectorC2Ev; Vir
tualSofts::SQL::DBConnector::DBConnector(void); VirtualSofts::SQL::DBConnector::DBConnector())
I've tried to declare a constructor for DBConnector but the problem persists.
Here the code of DBConnector :
namespace VirtualSofts
{
namespace SQL
{
class DBConnector
{
protected:
bool m_Connected;
String m_errorState;
public:
virtual ~DBConnector()
{
Disconnect();
}
//------------------------------------------
// Accès à la base
//------------------------------------------
virtual bool Connect(String db);
virtual bool Disconnect();
//------------------------------------------
// Accesseurs
//------------------------------------------
inline bool IsConnected() const { return m_Connected; }
//------------------------------------------
// Exécution de requêtes
//------------------------------------------
virtual int SQLExecDML(const String &request);
virtual cResultSet SQLExecQuery(const String &request);
//------------------------------------------
// Gestion des Erreurs
//------------------------------------------
String GetLastError() const {return m_errorState;}
};
}
}
and here the code of MySQLConnector :
namespace VirtualSofts
{
namespace SQL
{
class MySQLConnector: public DBConnector
{
//...
public:
//------------------------------------------
// Accès à la base
//------------------------------------------
virtual bool Connect(String db);
virtual bool Disconnect();
//------------------------------------------
// Exécution de requêtes
//------------------------------------------
virtual int SQLExecDML(const String &request);
virtual cResultSet SQLExecQuery(const String &request);
};
}
}
The problem appears when i instantiate the object by this way :
DBConnector *dbcnx = new MySQLConnector();
The code is ok ?
If i not use the virtual functions, all is ok...
Thanks for help ^^,
Lucas
[Updated on: Thu, 23 December 2010 14:48] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon Apr 28 19:44:24 CEST 2025
Total time taken to generate the page: 0.00897 seconds
|
|
|