If I don't mark a method as virtual, will it be available to a derived class?
If using object a, I make changes to method of base class. Then object b accesses the same method m1() of the base class (which is available to derived class).
Will it print those changed value by object a?
Will they share common method ?
class A
{
public int m(int i)
{
return i * i;
}
}
class B : A
{
}
class C
{
static void Main()
{
A a = new A();
int x = a.m(2); // returns 4
B b = new B();
int y = b.m(4); // 16
}
}