A top-level class definition (also called an outer class) Static variables and static methods in the top-level class, as well as static initialization code blocks Member variables and methods for the top-level class Classes with no user-defined constructor — these have an implicit, no-argument constructor An interface definition in the top-level class An interface that extends another interface Inner class definitions (one level deep) within a top-level class A class that implements an interface (and, therefore, its associated sub-interface) by implementing public versions of the method signatures An inner class constructor definition and invocation An inner class member variable and a reference to it using the this keyword (with no arguments) An inner class constructor that uses the this keyword (with arguments) to invoke a different constructor Initialization code outside of constructors — both where variables are defined, as well as with anonymous blocks in curly braces ({}). Note that these execute with every construction in the order they appear in the file, as with Java. Class extension and an abstract class Methods that override base class methods (which must be declared virtual) The override keyword for methods that override subclass methods Abstract methods and their implementation by concrete sub-classes The protected access modifier Exceptions as first class objects with members, methods, and constructors
It will not get with sharing, it will give error: = : member variable not visible for assignment
See the discussion below,
http://salesforce.stackexchange.com/questions/33941/subclass-doesnt-have-visibility-to-abstract-base-class-member-variable
Also See the article below,
A top-level class definition (also called an outer class)
Static variables and static methods in the top-level class, as well as static initialization code blocks
Member variables and methods for the top-level class
Classes with no user-defined constructor — these have an implicit, no-argument constructor
An interface definition in the top-level class
An interface that extends another interface
Inner class definitions (one level deep) within a top-level class
A class that implements an interface (and, therefore, its associated sub-interface) by implementing public versions of the method signatures
An inner class constructor definition and invocation
An inner class member variable and a reference to it using the this keyword (with no arguments)
An inner class constructor that uses the this keyword (with arguments) to invoke a different constructor
Initialization code outside of constructors — both where variables are defined, as well as with anonymous blocks in curly braces ({}). Note that these execute with every construction in the order they appear in the file, as with Java.
Class extension and an abstract class
Methods that override base class methods (which must be declared virtual)
The override keyword for methods that override subclass methods
Abstract methods and their implementation by concrete sub-classes
The protected access modifier
Exceptions as first class objects with members, methods, and constructors
https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_example.htm
Regards,
Ashish