vaade_veedu Posted May 17, 2015 Report Posted May 17, 2015 Search for "monkeypatching" uncle...nenu object ki variable or method assign cheyali ante class lo define cheyalsina avasarm ledu...at runtime cheyochu with that object... Java lo cheylam anukunta recent g telsukunna
dewarist Posted May 17, 2015 Report Posted May 17, 2015 encapsulation ante hiding variables/functions/innerclasses ... private, public ani istaam variable/function mundu ...private aithe vere class nundi ee variables/functions access cheyyalem ------------- inheritance ante oka class extends another class... A extends B, ante B lo unna functions anni A lo untayi... for eg B lo fun1(), fun2() unnayi... A lo fun3() undi.. A a = new A(); ani call cheste, A.fun1(), A.fun2() kooda valid since A extends B. --------------- polymorphism ante main concept oka method overloading, functions is same but definitions are different.. for eg. 1. same function name will have different arguments but they will be different functions. like func(int a); funct(int a, string B); 2. Same with constructors.. new Class(); new Class(a);( ..if you define a constructor Class(int a) in the class.) 3. Same function with different definitions in superclass/subclass (A extends B ante A is subclass B is superclass) ------------ Polymorphism has nothing to do with method overloading It explains that an object can exhibit various behaviors at different times.
pythonic Posted May 17, 2015 Report Posted May 17, 2015 Java lo cheylam anukunta recent g telsukunna Yeah...aa way it works chusthe looks like we can do it in dynamic languages...
pythonic Posted May 17, 2015 Report Posted May 17, 2015 Polymorphism has nothing to do with method overloading It explains that an object can exhibit various behaviors at different times. adhe...method overloading is one way to achieve polymorphic behavior...
dewarist Posted May 17, 2015 Report Posted May 17, 2015 adhe...method overloading is one way to achieve polymorphic behavior... ori magada..method overloading cannot span across multiple classes. So method overloading does not lead to polymorphic behavior though it is conceptualized that way. You have to take into account that the object itself doesn't behave in a different way with overloading. Overloading is way to have multiple implementation forms of a method. It's with inheritance that will lead to polymorphic behaviour..an supertype can refer to subtype object..so at run time each of the supertypes can actually be referring to the subtype objects
pythonic Posted May 17, 2015 Report Posted May 17, 2015 ori magada..method overloading cannot span across multiple classes. So method overloading does not lead to polymorphic behavior though it is conceptualized that way. You have to take into account that the object itself doesn't behave in a different way with overloading. Overloading is way to have multiple implementation forms of a method. It's with inheritance that will lead to polymorphic behaviour..an supertype can refer to subtype object..so at run time each of the supertypes can actually be referring to the subtype objects There are several fundamentally different kinds of polymorphism: If a function denotes different and potentially heterogeneous implementations depending on a limited range of individually specified types and combinations, it is called ad hoc polymorphism. Ad hoc polymorphism is supported in many languages using function overloading. If the code is written without mention of any specific type and thus can be used transparently with any number of new types, it is called parametric polymorphism. In the object-oriented programming community, this is often known asgenerics or generic programming. In the functional programming community, this is often simply called polymorphism. Subtyping (or inclusion polymorphism) is a concept wherein a name may denote instances of many different classes as long as they are related by some common superclass.[3] In object-oriented programming, this is often referred to simply as polymorphism. Naku nee post sariga ardham kaledu kani uncle...by gist of it I think you are referring to Subtyping...nuvvu baga sure ayithe needhe correct nenu antha reading veyaledu ee topics meedha :)
Recommended Posts