Andrey Gusev wrote:
This question was posted to fpc-other, yesterday, but seems wrongful,
in subject appropriation sense to that maillist.
===========
I wish to introduce some additional (and general) functional to an
existing (and foreign) freepascal's unit. I wouldn't to introduce any
my own code to that foreign module, consider to development process,
svn updation...
With C++'s multiple inheritance quality it is easy to implement:
---
#include <stdio.h>
#include <list>
using namespace std;
class TObj {
protected:
int fff;
};
type
TObj = class
protected
fff: integer;
end;
class TObj2: TObj {
protected:
int fff2;
};
type
TObj2 = class(TObj)
protected
fff2: integer;
end;
class TIntf {
public:
virtual void ppp() = 0;
};
type
TIntf = interface
procedure ppp;
end;
class TObji: public TIntf,TObj {
public:
virtual void ppp();
};
type
TObji = class(TObje, TIntf)
public
procedure ppp; virtual;
end;
class TObj2i: public TObji,TObj2 {
public:
virtual void ppp();
};
type
TObj2i = class(TObj2, Tintf) //you do not need to use multiple
inheritance here!! TObj2 already inherits from TObj
public
procedure ppp; virtual;
end;
But i can't invent nothing like that,
in object pascal, with him interfaces!
That is a translation of what you use as an example.
Alternate route is to use composition and/or aggregation.
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal