Let`s declare a class named Cars.Remember each class contain fields,methods,sub-classes and more.
standard definition:access return type class
Access modifier is how the class will be accessed could be publicly,privately,protected....
public class Cars
//let`s declare some fields ,you can add more depending on your requirement.
public int ntires;
public bool sunroof=true;
//let declare a method
public void Start()
Public void Stop()
//You could add Property,structs and more
} //end class Cars
//Now let create a class that will use all fields and methods of Cars class=INHERITANCE
//u use : in front of sub class like JapaneseCar
Public class JapaneseCar:Cars
//JapaneseCar class will inherit all fields,methods.... of Cars Class and can implement it own
//Let say i dont a sub class inherits a given class .The anwer is you need to seal the class you dont to be inherited with the keyword sealed
//Let create 2 classes:
public sealed class AllCars
public class ChineseCars :AllCars
/Putting a colon in front of ChineseCars will not work and generated error because
//AllCas class is sealed
If you have question or concerned see me here.
For training go to www.africtek.com
TALLEY JOHN OURO
- Raleigh, NC, United States