Static Variable in Functions and as Class Member

This video tutorial explains the static keyword in c++.
You are gonna learn what are static variables, how to use static variables in functions, how to declare static members in classes, how to initialize and use them in detail with example.

link for the next video tutorial on static member functions in classes

source code for this tutorial

#include <iostream>

using namespace std;

class Human{
    static int human_count;


    void humanTotal(){
    cout << "There are "<<human_count<<" peoples are in this program" <<endl;

    static void humanCount(){
     cout << "There are "<<human_count<<" peoples are in this program " <<endl;


int Human::human_count = 0;
int main()
cout << Human::human_count<<endl;

Human anil;
Human anjali;
Human rashith;
Human sandeep;
Human ::humanCount();
cout << Human::human_count<<endl;

    return 0;

Back To Top