Question : Whether b.x =1 statement in class A and class B is okay or not ?
public class A
{
int x;
static void SetX(B b)
{
b.x = 1; }
}
public class B : A
{
static void SetX(B b)
{
b.x = 1;
}
}
Answer :
b.x = 1 in Class A is fine.
b.x = 1 in Class B gives compilation error
No comments:
Post a Comment