Re: Child objects inheriting property values

Adrian Martin <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.clr
Message-ID <[email protected]>
Forget the last one! - I just thought it through , sorry!

Your idea of having the Record know its parent is better, and you see
this quite a lot in the BCL. 







-----Original Message-----
From: Discussion of development on the .NET platform using any managed
language [mailto:[email protected]] On Behalf Of Adrian
Martin
Sent: 20-November-2007 13:29
To: [email protected]
Subject: Re: Child objects inheriting property values

        class Column : Record
        {
                public Column()
                {
                        this.Delimeter = base.Delimeter;
                }
        }







-----Original Message-----
From: Discussion of development on the .NET platform using any managed
language [mailto:[email protected]] On Behalf Of Brady
Kelly
Sent: 20-November-2007 10:10
To: [email protected]
Subject: Child objects inheriting property values

I have a hierarchy of objects that share some attributes, e.g. both my
parent Record and Column objects have a columnDelimiter property.  I
want
this property on the Column object to default to the same property on
the
Record object, until specified on the Column object.  What is the best
way
to go about this?  I could give each Column a reference to the Record it
belongs to, but this seems not quite right to me.  My other option is to
have the Record act as a ColumnFactory, setting the columnDelimiter
value on
each Column it creates, until a set accessor on Column optionally
overrides
that default value.


===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


Johnston Press plc      Registered in Scotland no. SC015382
Registered Office: 53 Manor Place, Edinburgh, EH3 7EG

Opinions expressed in this email are those of the writer and not the
company.  E-mail traffic is monitored within Johnston Press and messages
may be viewed.  This e-mail and any files with it are solely for the use
of the addressee(s).  If you are not the intended recipient, you have
received this e-mail in error.  Please delete it or return it to the
sender or notify us by email at [email protected]

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


Johnston Press plc      Registered in Scotland no. SC015382        Registered Office: 53 Manor Place, Edinburgh, EH3 7EG

Opinions expressed in this email are those of the writer and not the company.  E-mail traffic is monitored within Johnston Press and messages may be viewed.  This e-mail and any files with it are solely for the use of the addressee(s).  If you are not the intended recipient, you have received this e-mail in error.  Please delete it or return it to the sender or notify us by email at [email protected]

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.