
Let us understand this C++ feature with the help of an example.
NOTE C PLUS PLUS CODE
Platform or Machine Independent/ PortableĪlthough C++ is not platform-independent as compiled programs on one operating system won’t run on another operating systemīut in another term, portability refers to using the same piece of code in varied environments. Clearly, polymorphism refers to displaying that data in more than one form.Ģ.
Polymorphism: The word poly means ‘many’ and morphism means ‘forms’. It is important to note that data encapsulation is different from data hiding as encapsulation mainly focuses on shifting the focus on important data than explaining its complex nature. It is basically responsible for securing the data. Data hiding: Data hiding refers to protecting data from unauthorized access. This concept reduces the redundancy of the program and makes it easy to transfer/copy the properties of one class to another We can implement the basic idea of inheritance by creating more than one class, which we formally refer to as derived classes by linking them with what we call the base class. Inheritance: The term inheritance refers to transferring the properties of the parent class to the child class. Data encapsulation: Data encapsulation is nothing but a process to implement data abstraction by wrapping up the data and functions into an exclusive block. Data abstraction: Data abstraction is an act of representing the important features of data without including the background details or the method applied to obtain it. We have briefly discussed all the 5 main concepts of object-oriented programming. These objects help you implement real-time problems based on data abstraction, data encapsulation, data hiding, and polymorphism. It employs the use of objects while programming. This is one of the most important features of C++. OOP (Object-Oriented Programming)Ĭ++ is an object-oriented language, unlike C which is a procedural language.
Stay updated with latest technology trends