Skip to content

Instantly share code, notes, and snippets.

@gpetuhov
Last active March 17, 2017 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gpetuhov/01de3cf2f279fe0a8cfdf893d642fedc to your computer and use it in GitHub Desktop.
Save gpetuhov/01de3cf2f279fe0a8cfdf893d642fedc to your computer and use it in GitHub Desktop.
C++ Class example
#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