C++ examples for Class:Member Field
The Car Class with a Member Variable
#include <cinttypes> #include <iostream> using namespace std; class Car//from w w w. ja v a 2s .c om { public: int m_NumberOfWheels; }; int main(int argc, char* argv[]) { Car myCar; myCar.m_NumberOfWheels = 4; cout << "Number of wheels: " << myCar.m_NumberOfWheels << endl; return 0; }