I have A Parent Class Animal And Child Class Dog.
Public Class Animal
{
public int Height = 0;
}
Public Class Dog : Animal
{
public int AnimalHeight()
{
return this.Height;
}
}
//Executing the Code in Main Method
Public Static Void main(stirng [] args)
{
Animal animal = new Animal();
animal.Height = 100;
Dog dog = new Dog();
var heights = dog.AnimalHeight(); // why I didn't get 100 in this variable????
}
You can see I have Assign 100 Height in parent why I didn't get 100 in this variable 'heights'? .......................................... I just want to achieve that when I set variable on one side and it sets on all child Classes simple.