Ad Code

Responsive Advertisement

Static Data members program.


 // static data members
#include<iostream>
using namespace std;

class abc
{
	static int roll;	// define the static veriable
	public:
		void get()
		{
			cout<<"roll is  : "<<roll;
		}
	
};

int abc::roll=10; 	// Here we addign the value using scope resolution

int main()
{		
	abc st;
	st.get();	

}
our roll No is : 109

Post a Comment

0 Comments