Re: Inheritance basic issue form newbie

From: Leor Zolman (leor_at_bdsoft.com)
Date: 04/04/04


Date: Sun, 04 Apr 2004 03:12:54 GMT

On Sat, 3 Apr 2004 20:30:01 +0200, "Marco" <m.traversoNOSPAM@libero.it>
wrote:
>
>Well, I didn't explain the situation: it's a plug-in that is hosted in an
>external App. It is compiled into different modules that are "commands"
>called from within the host app. Every command creates a derivedX object
>with a "derivedX objx;" instruction and destroys all its local variables at
>the end of its execution. The fact is that I need to store the created
>objects so that when another command is executed it can access the
>previously created objects...
>
>I hope I clarified my "situation"...

Since I don't deal with plug-ins and such myself, I have a difficult time
relating to your particular environment, but fortunately there are lots of
other folks who read this group and are likely to have a good handle on it.

>
>>
>> >so once I create a derived1 obj1 object
>> >I need to store them in a "global container" to make them available even
>> >after the call to the destructor function (that destroys the obj1
>object).
>>
>> Whoa. Not sure what you're trying to say there, but no object remains
>> "available" after its destructor has run; that's why it is called a
>> "destructor".
>
>Actually I can store an object as a global variable, or better, a member of
>a global class (declared in another "module") that is accessible from all
>the commands.

What about having the global container (array or whatever) just store
pointers to the base class. In whatever function obj1 is first
instantiated, create a dynamically-allocated copy of obj1 and install a
pointer to in the container. Then when the original obj1 turns into a
pumpkin, you've got the copy on the free store (complete with all of its
properties) and a pointer to it.
        -leor

-- 
Leor Zolman --- BD Software --- www.bdsoft.com
On-Site Training in C/C++, Java, Perl and Unix  
C++ users: Download BD Software's free STL Error Message Decryptor at:
   www.bdsoft.com/tools/stlfilt.html


Relevant Pages

  • Re: 3.0.9 - shop UI changes are for the worse.
    ... I think the right approach is to consider items in the store to be analogous ... Any command you could give followed by a '-' to select from the floor should ... be usable in the shop in the same way, ...
    (rec.games.roguelike.angband)
  • Re: PKZip25 - How to include the current folder to the files ?
    ... I use -dir=full and list files, as in this example, but it should work ... PKZIP Command Line Translation Table ... store directory path names during compression, ...
    (comp.os.msdos.misc)
  • Re: link new field command button to contacts
    ... The ContactItem object has only one place to store such links -- in the Links collection. ... Author of Configuring Microsoft Outlook 2003 ... the same contact in all of the command button fields that I have set up. ... those automatically to my calender so it sets up a reminder? ...
    (microsoft.public.outlook.program_forms)
  • Re: automate photo import, link, and name
    ... Having read the threads you'll understand that it's best not to store ... You can get a list of them that you can import by opening a command ... and use an update query to extract the ID from the ... filename and put it into the new ID field. ...
    (microsoft.public.access.externaldata)
  • Re: ultra newbie question (dont laugh)
    ... you need to do is take data from the user (through a GUI, command line, ... etc.) and store them in some persistent state (text file, pickle, db, ...
    (comp.lang.python)