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 302 views
2 answers 268 views
1 answer 268 views
1 answer 296 views
1 answer 226 views
...