Inheritance is one of the most characters of classes.
class phone
{
public double weight;
public string make;
public phone(string m) {make=m;}
public string dial() {return "keyboard";}
public string imake
{
get
{
return make;
}
set
{
make = value;
}
}
}
class smartphone : phone
{
double screenwidth;
double screenheight;
public string dial() {return "touch screen";}
public smartphone(string m,double w, double h) : base(m)
{make=m;screenwidth=w;screenheight=h;}
}
smartphone sp = new smartphone("Apple",6.2,10);
sp.imake = "Samsung";
sp.dial(); //touch screen
sealed class tv
{...}
class smartphone : tv {...} //error
class camera
{...}
class smartphone : phone, camera
{
...
}