본문 바로가기

카테고리 없음

Access Modifiers | Unreal Engine | C++ Programming

Access Modifiers

(tutorialspoint.com) - Access Modifiers are used to implement data hiding in object oriented programming. There are three types of access modifiers used in C++. These are public, private and protected. Details about these are given as follows.

 

What is Public?

The data members and member functions in a class that are declared public are available to everyone, including other classes. They can be accessed from any place in the program using the dot operator with the class object.

 

What is Private?

The data members that are declared private are only accessible from the functions inside the class and not by any functions outside the class. Friend functions can also access the private data members of a class.

 

What is Protected?

The data members of the class that are declared protected are similar to those declared private. They cannot be directly accessed outside the class but they can be accessed by the derived class of the base class