Skip to content

Instantly share code, notes, and snippets.

@olegwtf
Created January 26, 2012 17:34
Show Gist options
  • Save olegwtf/1683939 to your computer and use it in GitHub Desktop.
Save olegwtf/1683939 to your computer and use it in GitHub Desktop.
Encapsulation
#include <iostream>
class Ax {
public:
Ax(int a);
bool compare(const Ax &other);
private:
int m_a;
};
Ax::Ax(int a) {
m_a = a;
}
bool Ax::compare(const Ax &other) {
return m_a == other.m_a;
}
int main() {
Ax a1(4), a2(5);
std::cout << a2.compare(a1) << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment