Thanks i got it .. It's working fine for me now..... Charles Oliver Nutter-2 wrote: > > tonyaim83 wrote: >> Hi >> Java code >> >> Shape s1= obj.getShape(); >> s1.draw(); >> >> Circle c1 = (Circle)obj.getShape(); >> c1.getRadius(); >> >> It's equivalent ruby code >> >> s1 = obj.getShape >> s1.draw >> >> c1 = obj.getShape >> c1.getRadius >> >> Now here i cannot use the type cast as i have used in java so not able >> to >> invoke the methods of class circle. How to invoke it in ruby.? The code >> in >> bold is giving error. > > You should not have to cast anything in Ruby, since we just dispatch to > whatever methods are actually there. If the method is there, you can > call it. Can you show us the error? > > - Charlie > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > >
-- View this message in context: http://www.nabble.com/How-to-cast-object-in-ruby-tp22802352p22819863.html Sent from the JRuby - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email