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 185 views
1 answer 146 views
1 answer 129 views
1 answer 99 views
1 answer 204 views
...