Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
#include
using namespace std; class MyClass { // The class public: // Public access specifier int x; // Public attribute (int variable) }; int main() { MyClass myObj; // Create an object of MyClass // Access attributes and set values myObj.x = 15; // Print values cout << myObj.x; return 0; }
15