private and protected in c 2b 2b

Solutions on MaxInterview for private and protected in c 2b 2b by the best coders in the world

showing results for - "private and protected in c 2b 2b"
Valerio
07 Jan 2019
1protected://means all sub classes and base class can access these functions and variables butcan't be accessed outside classes
2public://Pubic methods and variables can be accessed inside and outside of the class
3private://only entity class can read and write the variables exeption is friend
Sofia
18 Oct 2020
1class A 
2{
3public:
4    int x;
5protected:
6    int y;
7private:
8    int z;
9};
10 
11class B : public A
12{
13    // x is public
14    // y is protected
15    // z is not accessible from B
16};
17 
18class C : protected A
19{
20    // x is protected
21    // y is protected
22    // z is not accessible from C
23};
24 
25class D : private A    // 'private' is default for classes
26{
27    // x is private
28    // y is private
29    // z is not accessible from D
30};
queries leading to this page
private and protected members in c 2b 2bprivate vs protected c 2b 2bis protected and private the same in c 2b 2bpublic private and protected variables in c 2b 2bc 2b 2b class public private protected examplehow to access private and protected members in c 2b 2bwhat is private protected and public in c 2b 2bprotected public private c 2b 2bprivate public protected in c 2b 2b with examplec 2b 2b program to differentiate between private 2cpublic and protectedexample of public protected and private inheritance in c 2b 2bwhen to use protected vs private c 2b 2bdifference between protected and private c 2b 2bprivate methods c 2b 2bpublic private protected c 2b 2bc 2b 2b protected vs privatec 2b 2b public private and protectedwhy we use private in c 2b 2bpublic protected private c 2b 2bpublic private protected c 2b 2b deferenceprotected vs private cppdifference between public 2c private and protected in c 2b 2b with examplewhy are private in c 2b 2b usedwhy is private public and protected in c 2b 2bdifference between public protected and private in c 2b 2bpublic 2c private protected c 2b 2bpublic private and protected c 2b 2bprivate public and protected c 2b 2bprivate public protected in c 2b 2bdifference between public 2c private and protected in c 2b 2bdifference between private and protected in c 2b 2bpublic private and protected inheritance in c 2b 2bpublic 2c protected and private inheritance in c 2b 2bwhat is the use of public and private in c 2b 2bpublic protected private cppdifference between private and protected c 2b 2bwhat is the difference between private and protected in c 2b 2bcan something be private and protected c 2b 2bpublic protected private in c 2b 2bprivate protected private c 2b 2bprivate versus protected members c 2b 2bwhat is public private and protected in c 2b 2bexample of public private and protected in c 2b 2bpublic protected and private in oops c 2b 2bprotected vs private c 2b 2bcan we access protected and private members of a class c 2b 2bprivate and public in c 2b 2bpublic private protected class in c 2b 2bdifference between public private and protected in c 2b 2bc 2b 2b public protected privatewhat are public private and protected in c 2b 2bwhat is private public protected in c 2b 2bprotected private public c 2b 2bc 2b 2b program using public private protectedpublic private and protected in c 2b 2b with exampleuse of public private and protected in c 2b 2bprivate protected public c 2b 2bc 2b 2b protected vs private methoddifference between public protected and private c 2b 2bwhat is private in c 2b 2bprivate vs protected in c 2b 2bc 2b 2b private protected publicpublic private and protected class in c 2b 2bc 2b 2b private vs protectedc 2b 2b private variableswhy are public and private used in c 2b 2bprivate and protected in c 2b 2bpublic private protected in c 2b 2buse of private in c 2b 2b 5cdifference between private protected and public in c 2b 2bprivate in c 2b 2bc 2b 2b public private protectedprivate and protected in c 2b 2b