<<< C++ program fundamentals | Index | class Date implementation >>> |
C++ programmer describes user-defined types using keyword class:
#include <iostream> class Date { // member variables int serial_date; public: // member functions void set_date( int month, int day, int year ); int get_month(); int get_day(); int get_year(); }; int main() { Date birthday; // instantiate object of type "Date" birthday.set_date( 2, 8, 1999 ); // member function calls std::cout << birthday.get_month(); return 0; }
<<< C++ program fundamentals | Index | class Date implementation >>> |