Posts

Showing posts from April, 2026

Encapsulation and 3 types || inheritance In C++ And Types

Image
 Encapsulation Encapsulation is defined as the wrapping up of data and information in a single unit. In Object Oriented Programming, encapsulation is defined as binding together the data and the functions that manipulate them. Consider a real-life example of encapsulation, in a company, there are different sections like the accounts section, finance section, sales section, etc. Methods | Variables Class Encapsulation (C++) :- Encapsulation facilitates data hiding in C++ by using private, protected and public access specifiers for restricting access to the class member functions and data members. There are 3 types of access modifiers available in C++: Public Private (default) Protected Public Specifier :- All the class members declared under the public specifier will be available to everyone. The data members and member functions declared as public can be accessed by other classes and functions too. The public members of a class can be accessed from anywhere in the program using the...