Kumar Gaurav

Kumar Gaurav

  • NA
  • 23
  • 18k

use of virtual/override on class variables as I can

Oct 10 2015 2:48 AM

Why can't I use virtual/override on class variables as I can on methods?

Like for example we have 2 classes
 
class A
{
public virtual int x;
}
class B : A
{
public override  int x;
}
  when i compile this above code it display error like "The modifier 'virtual' is not valid for this item"???
why display this type of error?? please help me in details . 

Answers (3)