A
archana
Hi all,
I am having suppose say following class
class MyClass
{
public int x;
public int y;
public const int c1 = 5;
public const int c2 = c1 + 5;
public MyClass(int p1, int p2)
{
x = p1;
y = p2;
}
}
here 2 variables c1 and c2 are constant. So those can be access
without creating object of class 'myclass'. So when i create new object
of class 'myclass' will this new object allocate new memory for
constant c1 and c2. of constant are stored at a time of loading
application only?
please correct me if i am wrong.
thanks in advance.
I am having suppose say following class
class MyClass
{
public int x;
public int y;
public const int c1 = 5;
public const int c2 = c1 + 5;
public MyClass(int p1, int p2)
{
x = p1;
y = p2;
}
}
here 2 variables c1 and c2 are constant. So those can be access
without creating object of class 'myclass'. So when i create new object
of class 'myclass' will this new object allocate new memory for
constant c1 and c2. of constant are stored at a time of loading
application only?
please correct me if i am wrong.
thanks in advance.