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()
{
  Console.WriteLine("Vooommm......");
}
Public void Stop()
{
  Console.WriteLine("Stoppinnnnnnng.....");
}
//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
//methods,fields....
}
//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
{
  //field,properties,methods...
}
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
Software Architect
Sunday, November 2, 2008
Subscribe to:
Post Comments (Atom)
Blog Archive
About Me
- TALLEY
 - Raleigh, NC, United States
 - I am a software developer based in Raleigh,NC,USA.I design softwares and systems ;i also do consulting for companies worldwide.I program with these languages:VB.NET 2003/2005/2008;C#;Java(fun),SQL(200,2005,2008);ASP.NET 2.0/3.5;ASP.NET AJAX;ASP.NET MVC;JavaScript;JQuery;Windows Workflow Foundation;Web Services.I have 4 years + in programming.
 
  
No comments:
Post a Comment