C++ Data Hiding, Setters, and Getters
C++ Object Oriented Programming. C++ Classes and OOP. In the previous video we went over how to define a struct, add class data members, and methods to represent a Student. In this video, we implement a new class, Fraction. Since the class is private by default, we implement setters and getters. Setters and getters are methods used to update/modify and read the data member values. This is better than leaving the data members public as you can control what can be set to the values.
This concept is known as data hiding, which is part of encapsulation.
C++ OOP Playlist:
• C++ Object Oriented Programming
Beginner C++ Playlist:
• C++ Programming Tutorial
Github Repo for C++ OOP Code:
https://github.com/ImKennyYip/cpp-oop
Install C++ with VS Code:
• How to set up C++ in Visual Studio Code
Subscribe for more coding tutorials 😄 !
🌟 If you enjoyed the tutorial and would like to support the channel, you can do so here: https://buymeacoffee.com/kennyyipcoding
Other Videos By Kenny Yip Coding
2025-09-23 | C++ Multiple Constructors and Polymorphism |
2025-09-22 | C++ Class Constructor |
2025-09-17 | C++ Const Member Functions (Const Methods) |
2025-09-16 | C++ Method Chaining |
2025-09-15 | C++ Data Hiding, Setters, and Getters |
2025-09-12 | C++ Classes and Access Specifiers |
2025-09-11 | C++ Structs and Classes OOP |
2025-09-10 | C++ Object Oriented Programming (OOP) |
2025-09-08 | Code Javascript Shooting Game (Duck Hunt) |
2025-08-21 | C++ Practice File Handling Reading and Writing to Csv Files |
2025-08-20 | C++ File Handling Read and Write to Csv Files |
2025-08-20 | C++ File Handling Read and Write to Text Files |
2025-08-18 | C++ String Stream |
2025-08-14 | C++ Practice File Handling Reading and Writing to Text Files |
2025-08-11 | C++ Date and Time with CTime |
2025-08-07 | C++ Algorithms and Vector Functions |
2025-08-05 | How to add a Custom Domain on Github Pages |
2025-08-05 | How to Host a Website On Github Pages |
2025-08-04 | Pygame Tutorial 26 - Animations |
2025-08-01 | Pygame Tutorial 25 - Game Over and Reset Game |
2025-07-31 | Pygame Tutorial 24 - Draw Text and Game Score |