multiple inheritance 
Author Message
 multiple inheritance

Hello,

In Free Pascal (v1.0.4+),
is there any syntax / structure / technique / usage that is similar
to the multiple inheritance in C++ or the method interface in Java ?

I intend to use it for object methods only.

(I know that the VMT is not designed to work in this way, so I'll
also look for techniques or even "dirty tricks")

For those who have heard "IS-A" and "HAS-A" relationships,
what i want is that:
an object X IS-A P and X IS-A Q  (at the same time)
and that i want to preserve this in the program,
without changing either relationship to a "HAS-A" one.

For example (using natural language),
An electronic book is both a "book" and an "electrical appliance"

Since it is a book, we can do something like
electronic_book.goToPage(1);

and sicne it is an electrical appliance, we can also do something like
electronic_book.powerOff();

In order to enable such an object to work with previous code,
the "electronic_book" must be defined such that other objects can
call it by both the "book" methods and the "electrical appliance"
methods without knowing in advance that the electronic book belongs
to both.

Is it possible ?

Thanks in advance.



Thu, 31 Jul 2003 06:44:25 GMT  
 multiple inheritance

Quote:

>Hello,

>In Free Pascal (v1.0.4+),
>is there any syntax / structure / technique / usage that is similar
>to the multiple inheritance in C++ or the method interface in Java ?

No. 1.1 will have Delphi styled interfaces though. (which is a kind of
MI-lite), but that is not yet (and won't be) in 1.0.x.
 You can try a snapshot (ftp.freepascal.org) to test this, but the 1.1.x
branch is not ready for production work yet.


Thu, 31 Jul 2003 17:30:47 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Multiple Inheritance

2. Multiple Inheritance

3. Multiple Inheritance

4. Q:Visual form's inheritance

5. Object inheritance

6. Inheritance

7. QR2 : why doesn't inheritance work ?

8. Problem with Property Inheritance

9. inheritance with hash variables

10. OOP problem with object types, inheritance and association between objects

11. Question about OOP Inheritance

12. DELPHI: Inheritance BUG??

 

 
Powered by phpBB® Forum Software