Article View: borland.public.csharpbuilder.language.csharp
Article #397Re: inherited / constructors : best code ?
From: OD
Date: Thu, 21 Jul 2005 22:45
Date: Thu, 21 Jul 2005 22:45
31 lines
3070 bytes
3070 bytes
Jon Shemitz a οΏ½crit :
> Yes, although it's redundant: "public class B() {}" is exactly
> equivalent to "public class B(): base() {}" (down to the "no
> parameter-less constructor" msg, if A has no public/protected
> parameter-less constructor.)
Ok, so c# will automatically and always call the first constructor in
inheritance chain that will match the parameter list (that can be
empty).
No always simple to change 10 years of Delphi practices ...
> I don't think case 1 or case 2 is always right: I'd always go with the
> version that reads the most clearly and/or takes the least custom
> code.
>
> In many cases, of course, the "local init" can get pushed to an
> ordinary, private method that simply gets called in two different
> constructors. (Though you can't set readonly fields from a normal
> instance method.)
It's what I did, so there's no "miracle" construction for this
situation.
Thanks a lot for your help.
--
Olivier Dahan
MK Query Builder
www.e-naxos.com
Technical Details
Message-ID:
<mn.b02d7d57be39b554.18651@0e-naxos.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<mn.ad937d57748784b9.18651@0e-naxos.com> <42E01E73.C32A6218@midnightbeach.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,40a1073c2533bd08 X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII Subject: Re: inherited / constructors : best code ? From: "OD" <OD[.@.]e-naxos.com> References: <mn.ad937d57748784b9.18651@0e-naxos.com> <42E01E73.C32A6218@midnightbeach.com> Newsgroups: borland.public.csharpbuilder.language.csharp Message-ID: <mn.b02d7d57be39b554.18651@0e-naxos.com> Organization: www.e-naxos.com X-Newsreader: MesNews/1.04.00.00 Date: Fri, 22 Jul 2005 00:45:46 +0200 MIME-Version: 1.0 Face: iVBORw0KGgoAAAANSUhEUgAAAC4AAAApBAMAAAHPlTYqAAAAB3RJTUUH0wwfAAI7FsnlTwAAA AlwSFlzAAALEgAACxIB0t1+/AAAAARnQU1BAACxjwv8YQUAAAAVUExURczMzP///5mZmWZmZjNmZpm ZzAAzM6IOup8AAAIwSURBVHjaXVOxkuMgDBV46eH20hMBqb0W6XeM4toh462vyOT/P+EEzm5uDmeGe Y8nCT0RwA8CrAPoLwLNAeA3AAwaAhD4cYB1IbgywXrRoCcE9ADvBPV4eowSceQSCMwxRR1AgdfeA5J S9EeUFt4/AYFhGGVb7rJVON3fR9BmnjtiJg/G10Cj1N0ukh1gHaHtb60WIp2dA2spSxJE60DqDNSAt /HxuI8N1Cf4aEDQYeU7IzWg0yFm5htNvYTNcnLb663qxuHse4wsFT8RvtfABXu7GIi8lCXqRcMHgJM LdDA5Z6Ed9evI1cCqHRxtxBVs6EAd+PHg6/AC92uTbXh9gYpHwOXB6w682ZZSbl1WjzpypmGP8Zo5c +jNGf+L47L3Y6o/8InnQKE3Z8+1XgSIi9VD5ItUD91g9YYyTuguS47ox5+2Reh125QApBk0+h3oLNP FZoisEGhSIN1b5bQ4k6k8ee+UyJUVl3Tjc+fRK+X6HMVJcSUT7TxYMJtJvXbPJG+rya0zgZflXqis8 ORr89gdolgmpvFZ/c8vT3744VE5U5/65ELn19R4u0WWgIIp9TTyihu/ih7nOE/blsLO90TKGuZZPuZ ET74FXO3A+yo/eqNlfE7008Ly2FKYSL42ktT4XFIszBdN+M2LXlnctii/BAEphNAmU5srJkYuc2oDk wG+XqjT7TJGCA3/rqS2bb1JXi+T8y9+wAlz8Vpr+Z+K832qbbAp54JCypE48Bf1mYlrJKOvfwAAAAB JRU5ErkJggg== Plugin-EXIF: J'utilise schexif de Chasta (http://www.chasta.com/fr/plugin.htm) Content-Type: text/plain; charset="iso-8859-15"; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 83.193.5.138 X-Trace: newsgroups.borland.com 1121985945 83.193.5.138 (21 Jul 2005 15:45:45 -0700) Lines: 33 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail