C++ static function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

C++ static function

As i know, in c++ we can call static function only this way: ClassName::FunctionName(); So why does this code work? https://code.sololearn.com/c1zFZSM0KxMg/?ref=app

28th Sep 2018, 1:00 PM
Anna Simonyan
Anna Simonyan - avatar
3 Answers
+ 2
is it something new?
28th Sep 2018, 3:06 PM
Anna Simonyan
Anna Simonyan - avatar
+ 1
Static members and methods of a class are shared among all of it's instances. Calling a static method using scope operator relieves you from instantiating an object of the class itself.
28th Sep 2018, 2:56 PM
Hoàng Nguyễn Văn
Hoàng Nguyễn Văn - avatar
+ 1
Anna Simonyan no, I suppose not. Definitely, not a new feature from modern C++.
28th Sep 2018, 3:11 PM
Hoàng Nguyễn Văn
Hoàng Nguyễn Văn - avatar