CPlusPlusThings/basic_content/static/static_funciton.cpp

15 lines
246 B
C++

#include <iostream>
using namespace std;
class Apple {
public:
// static member function
static void printMsg() { cout << "Welcome to Apple!"; }
};
// main function
int main() {
// invoking a static member function
Apple::printMsg();
}