Last active
March 17, 2017 09:20
-
-
Save gpetuhov/01de3cf2f279fe0a8cfdf893d642fedc to your computer and use it in GitHub Desktop.
C++ Class example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
class Add | |
{ public: short S1; | |
int f(int x) | |
{ return S1 + ++x;} | |
int A(short a, short b); | |
} K1; | |
int Add::A(short a, short b) | |
{ | |
this->S1 += a*b; | |
return this->S1; | |
}; | |
int main() { | |
K1.S1 = 2; | |
K1.f(2); | |
K1.A(0, 1); | |
cout << K1.S1; // Result is 2 | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment