This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

automatic casting


in code such as this:

if (o instanceof Dog)
    {
    Dog d = (Dog)o;
    d.bark();
    . . .
    }

why not eliminate the requirement to cast, since the
instanceof ensures that the object is of the right
type;i.e., u should be able to write:

if(o instanceof Dog)
    {
    o.bark();
    . . .
    }

what do u think?
-kartick


	
		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]