Let's start with following example:
A small example with two firms, A and B. While A is making a /for example/ database
connectivity libraries, B uses them and creates a tool for database management.
Firm A creates version 1.0 and publishes it, while B using it creates it's product.
After a while, a user installs database management tool and then updates /for his reasons/
a databases connectivity libraries to version 1.1.
Program starts to crash. Why? Because classes' methods are called by IDs, and they were
changed during library recompilation /Suppose the count of methods was changed/
while there are the same IDs in program.
class Database {
public:
Database();
~Database();
void execute(string str);
void commit(void);
};
|
|
class Database {
public:
Database();
~Database();
void execute(string str);
void execute(string str,vector<string> params);
void commit(void);
};
|
|
So, as you see instead of commit(), an execute(string,vector) is called.
If you think (as I though a year before) that you just need to move execute(string,vector)
after commit() and the matter is solved, than just think of inheritance.
Whatever order it be, say, an ExtendedDatabase class, an ancesstor of Database
will have it method IDs moved.
|