Re: Methods overloading?
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Sun, 12 Feb 2006 18:30:22 -0500
COM does not support overloading; instead, it supports encapsulation. So what you need to
do is create a new ActiveX control that embeds the one you want, and call its methods. It
is then free to do whatever it wants to translate to the contained control. ActiveX
controls can nest.
There is a strong set of debates as to whether encapsulation or inheritance is a better
methodology. I tend to favor encapsulation, as an idea, but it is so complex to implement
in ActiveX that I have avoided it. It solves a lot of inheritance-related problems, such
as do you call the superclass before, after, or in the middle of, whatever you are doing
to implement the overload?
[True story: I woke up after two major surgeries in 36 hours, the second to correct
problems caused by the first. In the haze of post-surgical anaesthesia hangover, massive
amounts of morphine being injected into me, loss of over half my blood due to internal
hemorrhaging, and unbelievable pain, I realized I had a nasogastric tube up my nose
keeping my stomach drained, and another tube keeping my bladder drained. One thought
sprang crystal-clear into my mind: "Good grief! My input/output methods have been
subclassed!". This was reassuring, because I realized that given such an insight, I had
probably not suffered any brain damage from the blood loss. But for the next 24
hours--and I blame this entirely on the drugs--I was in a panic because I couldn't
remember if I had to call the superclass Stomach::Swallow before or after I swallowed...]
joe
On Thu, 9 Feb 2006 10:58:51 +0100, "Mittik" <accia77@xxxxxxxxxxx> wrote:
Hi,Joseph M. Newcomer [MVP]
i'm writing an activex control with MS VC++ 6.0,capable of drawing a certain
number of graphs (max 5 graphs),which i want the user to choose.
I would like to insert the data to be drawn with an InsertData method,but
i've discovered with a little disappoint that i can't overload activex
methods:indeed i would like the control to call the appropriate InsertData
function depending on the number of quantities chosen,and i had thought of
writing 5 different versions of the InsertData method,but,as already said,it
isn't possible.
Can you give me some advice?
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- Methods overloading?
- From: Mittik
- Methods overloading?
- Prev by Date: Re: Drawing in Windows 98
- Next by Date: Re: Windows 2003 server SetForegroundWindow|BringWindowToTop|SetWindow
- Previous by thread: Re: Methods overloading?
- Next by thread: Drawing in Windows 98
- Index(es):
Relevant Pages
|