Article View: borland.public.jbuilder.java.language
Article #8742Re: class reference from static context
From: Rick Ingham
Date: Thu, 01 Mar 2001 13:53
Date: Thu, 01 Mar 2001 13:53
15 lines
2123 bytes
2123 bytes
Thanks. I guess I can't be quite as clever as I'd hoped. I wanted to be able to spit out the class' name in front of any DEBUG messages from that class, but I guess I can't make that happen in a static method without hard coding the class name in each class. "Torsten Welches" <torsten.welches@who.cares.netcologne.de> wrote in message news:3a9e090b$1_2@dnews... > > "Rick Ingham" <rdingham@home.com> wrote: > >But will that work in subclasses that inherit the method and > >properly reflect the subclass' class name? > > There is no polymorphism magic involved with static methods. > They are always called on the declaration type rather than the > runtime type (unlike instance methods). That means you had to > "override" the method in each subclass anyway. > Or do I just miss what you are asking? > > Torsten
Technical Details
Message-ID:
<qvsn6.490338$U46.14681064@news1.sttls1.wa.home.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newshub2.home.com!news.home.com!news1.sttls1.wa.home.com.POSTED!not-for-mailReferences:
<97knfi$fdt3@bornews.inprise.com> <3a9def0f$1_2@dnews> <97kv03$2m31@bornews.inprise.com> <3a9e090b$1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,f19fee463664b3b0 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-01 05:54:06 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newshub2.home.com!news.home.com!news1.sttls1.wa.home.com.POSTED!not-for-mail From: "Rick Ingham" <rdingham@home.com> Newsgroups: borland.public.jbuilder.java.language References: <97knfi$fdt3@bornews.inprise.com> <3a9def0f$1_2@dnews> <97kv03$2m31@bornews.inprise.com> <3a9e090b$1_2@dnews> Subject: Re: class reference from static context Lines: 16 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: <qvsn6.490338$U46.14681064@news1.sttls1.wa.home.com> Date: Thu, 01 Mar 2001 13:53:26 GMT NNTP-Posting-Host: 24.11.173.110 X-Complaints-To: abuse@home.net X-Trace: news1.sttls1.wa.home.com 983454806 24.11.173.110 (Thu, 01 Mar 2001 05:53:26 PST) NNTP-Posting-Date: Thu, 01 Mar 2001 05:53:26 PST Organization: Excite@Home - The Leader in Broadband http://home.com/faster