@sasi and Sulekha....its Head First Java...which explained these properties to me. :)
On Thu, Mar 14, 2013 at 1:28 PM, sasi kumar <[email protected]> wrote: > @Manish Well Explained:) > @sulekha Probably you have to read Head First java which is an awesome > book that covers these topics with examples > > > On 12 March 2013 21:10, manish untwal <[email protected]> wrote: > >> according to my understanding the super class object have limited >> function like for example >> Class - animal : methods/behavior : roam() and eat() >> and a sub class hippo : method/behavior : roam(),eat() and swim() >> so a hippo is a animal then according to the polymorphic property of java >> a reference of animal can refer to object of class hippo and animal but >> still the reference can call only the behavior of class animal i.e : animal >> A = new hippo() is legal but you can't call A.swim() because it refer to >> the animal property of class hippo ie roam and eat...not swim. and also u >> can't do this as hippo H = new animal() as this means animal should have >> all the property of hippo because it is referred by a hippo reference do >> H.swim() should not be a NULL.....reply if you get it or not. >> P.S : I tried to explain it through an example >> >> On Tue, Mar 12, 2013 at 8:51 PM, sulekha metta >> <[email protected]>wrote: >> >>> what ever data members,member functions present in super class are >>> applicable to subclass...subclass may contain more additional >>> features....so its obvious that size of subclass object is more than >>> superclass object...now lets take an analogy of float(4 bytes) and double( >>> 8 bytes) float can be implicitly converted into double( as float size is >>> less when compared to double) but not vice versa....then why is this not >>> applicable to superclass object and subclass object(as size of superclass >>> object is less when compared to subclass)? please tell if am wrong! >>> >>> >>> On Tue, Mar 12, 2013 at 7:37 PM, subramony mahadevan < >>> [email protected]> wrote: >>> >>>> i think its just a logical reason .... take animal as superclass bird >>>> as subclass ... since we are talking about inheritance it is " is a >>>> relationship " ie bird is a animal not vice versa hence we cannot >>>> implicitly convert to subclass >>>> >>>> >>>> On Sat, Mar 2, 2013 at 6:18 PM, sulekha metta >>>> <[email protected]>wrote: >>>> >>>>> Q) why super class object can't be implicitly converted to subclass? >>>>> is there any specific reason? >>>>> Thanks in advance! >>>>> >>>>> -- >>>>> sulekha metta >>>>> B.E computer science >>>>> osmania university >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Algorithm Geeks" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>> >>>>> >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>>> >>>> >>> >>> >>> >>> -- >>> sulekha metta >>> B.E computer science >>> osmania university >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Algorithm Geeks" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> >> >> -- >> With regards, >> Manish kumar untwal >> Indian Institute of Information Technology >> Allahabad (2009-2013 batch) >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- With regards, Manish kumar untwal Indian Institute of Information Technology Allahabad (2009-2013 batch) -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
