+ 1

Can anyone explain me polymorphism and encaptulation in simple language?

i am totally confused in polymorphism and encaptulation because the concept that sololearn is teaching is completely different from that i had learned from my college teachers for these two topics.

24th Nov 2017, 12:31 PM
akash goel
akash goel - avatar
6 Respuestas
+ 7
Polymorphism can be easily understood by taking the "plus" operator as example. Depending on a parameter it takes, it adds numbers, concatenates strings and appends/joins lists. All is determined by the type of its parameters and it conforms to each of them differently.
24th Nov 2017, 1:45 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
24th Nov 2017, 12:51 PM
Oma Falk
Oma Falk - avatar
+ 1
Encapsulation means that you hide attributes and methodes inside your code, from any other part of code which tries to access it or modifie it. This could destroy your code's behaviour. Polymorphism is exactly what the word means. A piece of code which reacts differently, depending the object that needs it or the paramaters it passes. This makes your code more flexible. That's how i understand it
24th Nov 2017, 12:57 PM
Kostas Batz
Kostas Batz - avatar
28th Nov 2017, 1:49 AM
Anjaneyulu Bairi
0
just check it once may be it will be helpful to you
28th Nov 2017, 1:49 AM
Anjaneyulu Bairi
28th Nov 2017, 1:54 AM
Anjaneyulu Bairi