Example of a C++ class with encapsulation using private and public access specifiers.
C++ class with private members _id and _name, and public methods setId, getName, getId, setName.
Quality Assured by Worksheets Library Team
Reviewed for educational accuracy and age-appropriateness
ID: #689488