Definition of static data members in c++ :
It is known as a class data members and declared by using the Static keyword. it is a single copy of the variable created for all objects in C++.

Declaration :
Static Data_type Data_member_name
Static: Static is a keyword
Datatype : data_type in variable type in C++ like : int, float
Data Member Name: data member name is a user defined name of the variable
Example
static int sum;
Define the value of static data member
Also Read This :- function overloading in c++
it should be declared outside of class like this:
data_type class_name :: static_data_member_name = value;
Example of Static Data Member
#include<iostream>
#include<string.h>
using namespace std;
class Student {
 private:
 int rollNo;
 char name[10];
 int marks;
 public:
 static int objectCount;
 Student() {
  objectCount++;
}
void getdata() {
 cout << "Enter roll number: "<<endl;
 cin >> rollNo;
 cout << "Enter name: "<<endl;
 cin >> name;
 cout << "Enter marks: "<<endl;
 cin >> marks;
}
void putdata() {
 cout<<"Roll Number = "<< rollNo <<endl;
 cout<<"Name = "<< name <<endl;
 cout<<"Marks = "<< marks <<endl;
 cout<<endl;
}
};
int Student::objectCount = 0;
int main(void) {
 Student s1;
 s1.getdata();
 s1.putdata();
 Student s2;
 s2.getdata();
 s2.putdata();
 Student s3;
 s3.getdata();
 s3.putdata();
 cout << "Total created Object of Student Class = " << Student::objectCount << endl;
 return 0;
}output
Enter roll number: 1 Enter name: AAA Enter marks: 80 Roll Number = 1 Name = AAA Marks = 80 Â Enter roll number: 2 Enter name: BBB Enter marks: 65 Roll Number = 2 Name = BBB Marks = 65 Â Enter roll number: 3 Enter name: CCC Enter marks: 90 Roll Number = 3 Name = CCC Marks = 90 Â Total created Object of Student Class = 3
