Article View: borland.public.cppbuilder.nativeapi
Article #17743Re: multiple inheritance and the VCL
From: Stephan
Date: Tue, 04 Mar 2003 17:34
Date: Tue, 04 Mar 2003 17:34
44 lines
2671 bytes
2671 bytes
Hi,
last I heard, the VCL does not allow multiple inheritance.
I don't know the reason, but I heard it's a strict adherence to the concept
of
Object Oriented Programming
The way around this, for you, is to create a class that inherits the TForm
and implements your "common" functionality.
such as:
class TCommonForm: public TForm
Then, when you create a new form, change the inherated
from "TForm" to "TCommonForm"
Have Fun!
Stephan
"Paul Anderson" <paul.anderson@jhuapl.edu> wrote in message
news:3e64d1be@newsgroups.borland.com...
I would like to make a base class that essentially acts as an interface to
all forms in my application. I would like to then create forms which will
derive from the base class using the following class declaration:
class TFrom1 : public TForm, public BaseClass
Borland, however, will not let me compile this. Can someone PLEASE, PLEASE,
PLEASE tell me why!!! Any ideas on how I could inbed common functionality
into a form so that I can have a clean interface to them. I need to ensure
EVERY form will implement a certain function. I don't really care that it
is a form, only that we have a contract that the function I need will be
implemented and I can call it.
I will be storing the base class pointers in a vector<BaseClass> myForms and
calling a function something like myForms[x].UpdateState();
Please help if you can!!
The reason this is important is because I want IDE independent capabilities.
Users will derive from my base class and make their forms and I want to call
the UpdateState function and not care about whether it is a Borland TForm or
a MSVC++ form. Does anyone know why I can't do multiple inheritance with a
Borland form?????
THANK YOU SOOOOO MUCH!!!
Technical Details
Message-ID:
<3e64e3b0$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3e64d1be@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,679d8017f814d3b X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-03-04 13:28:35 PST From: "Stephan" <slaska@devarinc.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3e64d1be@newsgroups.borland.com> Subject: Re: multiple inheritance and the VCL Date: Tue, 4 Mar 2003 12:34:41 -0500 Lines: 48 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 64.252.14.74 Message-ID: <3e64e3b0$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1046799280 64.252.14.74 (4 Mar 2003 09:34:40 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail