+ 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.
6 odpowiedzi
+ 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.
+ 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
0
just check it once may be it will be helpful to you