Answers for "c++ How many functions (methods) can a class have?"

C++
5

c++ class method example

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;
}
Posted by: Guest on January-18-2020
0

c++ How many functions (methods) can a class have?

As many as you want
Posted by: Guest on July-21-2020

Code answers related to "c++ How many functions (methods) can a class have?"

Browse Popular Code Answers by Language