What are instance variables please? Also, is this a good explanation for Encapsulation:
Encapsulation or information hiding is all about hiding the details of the implementation of the interface. Encapsulation is used to prevent users from viewing the inner workings of the interface.
A real life example of Encapsulation is we know that we can breath without knowing how our bodies performs it.
In C++ classes have two parts, the interface and the implementation. The interface is the implementation for the external interface (what the user sees) i.e. a human being. The implementation is code that performs all the operations, walking, eating, talking etc. The general user should not be able to see the inner workings of the interface.
Encapsulation is used for many reasons in C++ one of the main reasons is so that the implementation code can be changed without affecting the interface. Encapsulation also prevents the program the program from relying on other programs which one small change could have a massive effect.
Encapsulation can also help improve the performance, fix bugs and bring together coding. `
Thanks for any advice =)