🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7782

rtti

#7782
From: rp
Date: Sun, 13 May 2001 21:18
15 lines
1132 bytes
What I would like to do is cast an object using a variable.
Is this even possible?

For instance what type would myCastVar be?

? myCastVar = null;

if(obj instanceof ClassType1) {
    myCastVar = ?;
}
else if(obj instanceof ClassType2) {
    myCastVar = ?;
}

System.out.println( ((myCastVar)obj).getName() );
Technical Details
Message-ID: <3afefaab$2_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,c7984d5e71674b17,start
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-05-13 14:42:04 PST
From: "rp" <admin@objectpascal.com>
Newsgroups: borland.public.jbuilder.java.language
Subject: rtti
Date: Sun, 13 May 2001 16:18:04 -0500
Lines: 18
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
NNTP-Posting-Host: 64.132.9.22
Message-ID: <3afefaab$2_1@dnews>
X-Trace: dnews 989788843 64.132.9.22 (13 May 2001 14:20:43 -0700)
Path: arc1-ca.pugleaf.net!archiver1.sj.google.com!newsfeed.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews