Public Data Members
All variables of a class are known as "data members of a class" and the variables which are declared in the public section of a class are known as "public data members of a class".
Public data members can be accessed through object name directly outside of the class.
Example:
Here, we have a class named "Numbers" with two public data members a and b, we will provide the value to them inside the main() and access (print) them inside main() also.
Program:
Output
need an explanation for this answer? contact us directly to get an explanation for this answer