How to run static method with class name without an object in C++

1 Answer

0 votes
#include <iostream>

using std::cout;
using std::endl;

class Test {
public:
	static void print(void) { cout << "class Test" << endl; };
};

int main()
{
	Test::print();

	return 0;
}



/*
run:

class Test

*/

 



answered Mar 13, 2018 by avibootz

Related questions

1 answer 283 views
1 answer 243 views
1 answer 232 views
1 answer 179 views
1 answer 316 views
...