#include <cstdlib> #include <iostream> using namespace std; class klass { int x, y; public: void nilai (int,int); int area (void) {return (x*y);} }; void klass::nilai (int a, int b) { x = a; y = b; } int main () { klass rect; rect.nilai (3,4); cout << "Area: " << rect.area()<<endl; system("PAUSE"); return EXIT_SUCCESS; }
0 Response for the "Basic program using class"
Post a Comment