Re: Inheritance Collection Classes

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Andrew (andrewt_at_nospam.dbasplus.com)
Date: 06/29/04


Date: Tue, 29 Jun 2004 13:03:06 +1000

Thanks for the response. Your right my terminology is wrong.
I was rather hoping that there would be a better way of referencing the
parent class other than passing it to the child. This is the same as VB6.
Cheers.

"NM" <NM_656@hotmail.com> wrote in message
news:%23Pcv5UPXEHA.208@TK2MSFTNGP10.phx.gbl...
> Hi Andrew,
>
> class inheritance means that :
> if you have a class A that inherit class B so the class A has all class B
> caracteristics (Public and Protected attributes, procedures and
functions).
> it's like if you say that a baby got the eyes of his father and the mouth
of
> his mother;
>
> Now what you want to do (if I understand) is to have a class Customer that
> have an attribute Emails (which is a class or a collection of classes)
wich
> have a reference to the Customer class;
> To do that, create your class Emails with a constructor which take the
> Customer class in parameter and store it in an Emails class attribute :
>
> Class Emails
>
> Protected myCustomer as Customer
>
> Public Sub new (Byref c As Customer)
> myCustomer = c
> End Sub
>
> ...
>
> End Class
>
>
>
> Regards
>
>
> "Andrew" <andrewt@nospam.dbasplus.com> a écrit dans le message de
> news:%23KNQ9mNXEHA.500@TK2MSFTNGP09.phx.gbl...
> > I need to have a series of collection classes that inherit (I think)
from
> > each other. What is the best way to do this in .NET? In VB6 I had a
series
> > of collection classes each passing a reference to the parent object down
> the
> > tree.
> >
> > For example:
> > Customer(s) -> Email(s) -> Attachment(s)
> >
> > Or maybe:
> > Directory -> Directory -> Directory -> Files etc
> >
> > Do I still simply pass teh reference to the parent down the tree?
> > I also need the child classes to get information form the parent.
> >
> > You also can't put:
> >
> > Public Class cAttachments
> > Inherits System.Collections.CollectionBase
> > Inherits cEmail
> > ...
> >
> >
> >
>
>



Relevant Pages

  • Re: Using early-bound interface on a late-bound object
    ... > the compiler determines which interfaces to use, ... > supports the declared interface. ... >> help if someone can point me to some authoritative document or reference ... within customer shops when they mirrored this 'division' to keep their ...
    (microsoft.public.vb.general.discussion)
  • RE: ObjectDataSource in ASP.NET 2.0
    ... For datasourcecontrol and databindig control, ... it don't quite makesense to maintain such a in-memory reference. ... again from orginal datasource, e.g: ... | Customer customer = new Customer; ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Show Group Footer Conditionally
    ... The problem - to show summary and detail for Customers who were grouped by Parent Company, and summary only for Customers who had no Parent Company. ... I ended up having to present the Customer records as a subreport with the Parent ... I grouped my report on CustSort and gave the group a footer but no header. ...
    (microsoft.public.access.reports)
  • Re: owner of class
    ... >> terminate a given object but because I've created circular reference, ... > Public Sub AttachParent ... > Then each class you need to know it's parent object can simply implement ... > Private Sub IParentTrack_AttachParent ...
    (microsoft.public.vb.general.discussion)
  • Re: Life of an instance
    ...     Customer cust = new Customer ... or one can hold a reference too long and prevent the JVM from ... Customer cust = new Customer; ... In Mark Space's example, once the pointer 'cust' goes out of scope, ...
    (comp.lang.java.help)