Friday, 23 April 2021

Scope Resolution Operator in C++ Qus: 3

 #include<iostream.h>

#include<conio.h>

class A

{

public:

int x;

static int y;

A()

{

x=5;

//y=10;

}

void show()

{

y=12;

}

};

int A:: y=15;


int main()

{

clrscr();

A ob;

cout<<ob.x<<endl;

cout<<ob.y<<endl;

getch();

return 0;

}

No comments:

Post a Comment