How to use static function in class with C++

1 Answer

0 votes
#include <iostream>

class Example {
    public:
        static void print() {
            std::cout << "static void print()";
        }
};

int main() {
    Example::print();
}  
  
  
  
/*
run:
  
static void print()
  
*/

 



answered Nov 27, 2022 by avibootz

Related questions

1 answer 307 views
2 answers 269 views
1 answer 272 views
1 answer 300 views
1 answer 233 views
...