Question

What is the primary purpose of using private class members in object-oriented programming?

A To allow unrestricted access to the class members from any part of the code.
B To enable derived classes to access and modify the base class members directly.
C To restrict access to the class members to only within the class itself, ensuring encapsulation and data hiding.
D To make class members accessible to other classes in the same package or module.
E To automatically generate getter and setter methods for class members.
Practice Next

Hey! Ask a query