Check out example codes for "c++ class method example". It will help you in understanding the concepts better.

Code Example 1

class Object {
public:
	int var;
	void setVar(int n) {
		var = n;
	}
	int getNum() {
		return var;
	}
};

int main() {
	Object obj;
	obj.setVar(13);
	std::cout << obj.getNum() << std::endl;
	return 0;
}

Learn ReactJs, React Native from akashmittal.com