what is polymorphism and encapsulation In C++ ? Explain plz with example. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

what is polymorphism and encapsulation In C++ ? Explain plz with example.

Programming Language

16th Nov 2017, 8:40 AM
SANDEEP SINGH RAWAT
SANDEEP SINGH RAWAT - avatar
3 Answers
+ 4
encapsulation or data encapsulation in c++ is nothing but wrapping up a set of data members and functions together to use it as one individual block so it can be used for future call statements. best example of encapsulation in c++ is classes and structures. polymorphism means expressing one unit in various other forms. it basically means using one function or an attribute to perform two or more activities. examples will be function overloading-two functions having same name but vary in the number of parameters or type of parameters, and by operator overloading- using same operator for more than 1 task like * which is used for multiplication as well as to get the value stored in a pointer
9th Jan 2018, 2:48 AM
Kailash .j
Kailash .j - avatar
+ 8
Encapsulation in C++ In normal terms Encapsulation is defined as wrapping up of data and information under a single unit. In Object Oriented Programming, Encapsulation is defined as binding together the data and the functions that manipulates them. For More -> http://www.geeksforgeeks.org/encapsulation-in-c/ Polymorphism in C++ The word polymorphism means having many forms. In simple words, we can define polymorphism as the ability of a message to be displayed in more than one form. For More -> http://www.geeksforgeeks.org/polymorphism-in-c/
16th Nov 2017, 9:11 AM
~Sudo Bash
~Sudo Bash - avatar
+ 1
encapsulation means encapsulate the detail I.e. hiding information by using access modifiers encapsulate the data and information in unit and access data by function and access modifier provide security and hide the detail how can work polymorphism mean one name many implement that is one method but have different implement vary by type of parameter .
11th Jan 2018, 4:44 PM
Priti K
Priti K - avatar