realbasic-plugins
[Top] [All Lists]

Re: Subclassing from my own plugin

To: REALbasic Plugins <realbasic-plugins at lists dot realsoftware dot com>
Subject: Re: Subclassing from my own plugin
From: Björn Eiríksson <bjorn at einhugur dot com>
Date: Sun, 24 Dec 2006 01:06:44 +0000
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-plugins at lists dot realsoftware dot com
References: <1hqtsrh dot 1cdx64v1x2a07yM%support at monkeybreadsoftware dot de>

On Dec 24, 2006, at 12:16 AM, Christian Schmitz wrote:

No. You should not assume that RB stored the data from a before or
behind the b data.

So you go the way Alfred showed. With different structs for each class.

This is not correct and I dont think it was what Alfred was actually saying to him at all.

When you inherit then you get all the structs from the child classes also

So if class a has struct a:

struct a
{
     int a;
     int b;
}

Then if you want a subclass with one additiona filed then you dont need to do

struct b
{
     int ab;
     int b;
     int c;
}

But instead you just do:


struct b
{
     int c;
}

But you can still access the int a and int b, the way Alfred just said.

If you are doing it any other way, having all the fields in a base class or defining the data over and over again then you are just simply wasting memory for nothing.
--
______________________________________________________________________
Björn Eiríksson                        bjorn at einhugur dot com
Einhugur Software
http://www.einhugur.com/
______________________________________________________________________
Einhugur Software has sold its products in 55 countries world wide.
______________________________________________________________________
For support:                           support at einhugur dot com
To post on the maillist:               plugins at einhugur dot com


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>