S
santosh
Hello,
I have a doubt about static variable.
class B
{
private:
static int x;
public:
static set(int y)
{
x=y;
}
};
int B::x=10;
class D1: class B
{
}
class D2: class B
{
}
Here if I modify the static variable by an object of class D1, then for the
object of D2 the same modification is visible.
Here suppose I want that D2 object's x should not be modified by modifying
D1 object's x.
How to acheive this?
Can it anyway be done by using templete class.
I have a doubt about static variable.
class B
{
private:
static int x;
public:
static set(int y)
{
x=y;
}
};
int B::x=10;
class D1: class B
{
}
class D2: class B
{
}
Here if I modify the static variable by an object of class D1, then for the
object of D2 the same modification is visible.
Here suppose I want that D2 object's x should not be modified by modifying
D1 object's x.
How to acheive this?
Can it anyway be done by using templete class.