|
Home ► Lab Exercise ► Object Oriented Programming Lab Exercise Programs ► CPP Program For Declaring Static Members as Class Member▼
CPP Program For Declaring Static Members as Class Member |
Alogarithm steps:
- Start the program
- Create the static class and declare the static data members in the class
- Declare the static member function
- Create the object for the static class
- Pass the static data value when we call the static member function in the main program
- Compile and execute the program
CPP Program For Declaring Static Members as Class Member
#include
class static_type
{
static int i;
public:
static void init(int x)
{
i = x;
}
void show()
{
cout<
SAMPLE INPUT AND OUTPUT:
100
1000
1000
|
|
⇓ Student Projects ⇓
⇑ Student Projects ⇑
|