+ 1
Why we use public in c++
2 Respuestas
+ 15
► Data members or member functions which are declared as public can be accessed anywhere in the program (within the same class or outside of the class).
► You can access public data members or function directly by using dot operator (.) or arrow operator-> with pointer.
► Using public with your data can be used when you want to make your data accessible at any level i.e. no restrictions for anyone, anyone can access it.
Hope this helps !!!
+ 2
😊