Write A Program In C++ To Implement Static Member Function In Class.

Write a program in C++ to implement static member function in class.
Algorithm to solve the above problem:1. Create class count with static data member as total.2. Create a member function to increment the count.3. Declare the static data member using scope resolution operator.4. Display the count and total value. (adsbygoogle = window.adsbygoogle || []).push({});

Implementation of the above problem in C++:#includeusing namespace std;class count{private:int number;static int total;public:count();int get_number();static int get_total();};count::count(){number=100+ total++;}int count::get_number(){return number;}int count::get_total(){return total;}int count::total=0;int main (){cout<<" Total count = "<count a, b, c;cout<<" a="<cout<<" b="<cout<<" b="<cout<<" Total count="<return 0;} (adsbygoogle = window.adsbygoogle || []).push({});

The output of the above program is tested on www.jdoodle.comOutput:Total count = 0a=100b=101c=102Total count = 3

ThanksMukesh Rajput