Posts

Showing posts with the label Public Private Protected

Access Specifiers in C++ – Public, Private and Protected with Examples

Access specifiers in C++ are used to control the accessibility of class members, including data members and member functions. They define which parts of a program can access the members of a class. C++ provides three access specifiers: C++ में Access Specifiers का उपयोग class के members अर्थात data members और member functions की accessibility को control करने के लिए किया जाता है। ये निर्धारित करते हैं कि program के कौन-से parts किसी class के members को access कर सकते हैं। C++ में तीन प्रकार के Access Specifiers होते हैं: public  private protected 1. Public Access Specifier in C++ The public access specifier allows class members to be accessed from anywhere in the program where the object or class is accessible. Members declared under public can be accessed using an object and the dot ( . ) operator. public access specifier class के members को program के उन सभी parts से access करने की अनुमति देता है जहाँ object या class accessible हो।  public के अंतर्गत declare किए गए member...