If static class member and static class function has a class scope then why can't I access the display function(it shows error)? If in place of display function I write count it displays the correct value i.e., 0
#include <iostream> #include <string> using namespace std; class Person { public: static int Length; static void display() { cout<< ++Length; } }; int Person::Length=0; int main() { cout<< Person :: display(); //error // Person :: Length shows correct value return 0; }