Re: [algogeeks] java
oh..ok thank you for replying :) On Tue, Mar 12, 2013 at 9:10 PM, manish untwal manishuntw...@gmail.comwrote: 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 metta.sule...@gmail.comwrote: what ever data members,member functions present in super class are applicable to subclass...subclass may contain more additional featuresso 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 versathen 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 subums...@gmail.com 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 metta.sule...@gmail.comwrote: 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 algogeeks+unsubscr...@googlegroups.com. 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 algogeeks+unsubscr...@googlegroups.com. 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 algogeeks+unsubscr...@googlegroups.com. 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 algogeeks+unsubscr...@googlegroups.com. 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[algogeeks] java
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 algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [algogeeks] java
what ever data members,member functions present in super class are applicable to subclass...subclass may contain more additional featuresso 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 versathen 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 subums...@gmail.comwrote: 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 metta.sule...@gmail.comwrote: 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 algogeeks+unsubscr...@googlegroups.com. 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 algogeeks+unsubscr...@googlegroups.com. 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 algogeeks+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [algogeeks] Re: INTERFACES VS ABSTRACT
@all thanks On Thu, Aug 23, 2012 at 6:08 PM, vaibhav shukla vaibhav200...@gmail.comwrote: Abstract class are used for Abstraction Interface are used for Polymorphism On Thu, Aug 23, 2012 at 6:06 PM, Amit Tiwari amit.monu...@gmail.comwrote: With an abstract class, the subclass of that inheritance tree only can and should provide the definitions of the methods. With an interface, subclasses of different inheritance tree can also implement the same methods. Interface provides a way to separate out and group common behavior of different inheritance trees. It is kind of a substitute for the multiple inheritance that some other languages provide. On Thu, Aug 23, 2012 at 4:59 PM, kings dns.bhar...@gmail.com wrote: Dear sulekha, when u want a default property to get embedded ie u want to force any feature use abstract. when u want an additional feature need to be added used interface. ex: For a car the default things are steering, engine, etc... if u want the car to compulsory to have A/c then add it in the abstract for a car having ABS is optional include it as an interface where ever u think its necessary. On Tuesday, 21 August 2012 21:20:45 UTC+5:30, sulekha .m wrote: hi all, why do we separately need interfaces in java?? we can declare all the methods in abstract class as abstract this serves the purpose,then why do we have interfaces??? -- sulekha metta B.E computer science osmania university -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/qI3YhsGoh7wJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- best wishes!! Vaibhav -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en. -- sulekha metta B.E computer science osmania university -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] MS QUESTION
Hi all, This was asked in microsoft, question is write a program to reverse a linked list.and write it's test cases. i got very few test cases 1) check if the node is null 2) check if there is only one node 3) check if there is any loop in the linked list. can any one tell how to reverse a linked list if loop exits? is it possible? and can any one add few more test cases?? -- Regards sulekha metta B.E computer science osmania university -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
[algogeeks] INTERFACES VS ABSTRACT
hi all, why do we separately need interfaces in java?? we can declare all the methods in abstract class as abstract this serves the purpose,then why do we have interfaces??? -- sulekha metta B.E computer science osmania university -- You received this message because you are subscribed to the Google Groups Algorithm Geeks group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.