Topic: Inheritance Differences between VB.Net and C#.Net
Share/Save/Bookmark
ACCESS
VB                C#                           AVAILABLE TO
Public            public                       All members in all calsses and projects
 
Friend            internal                     All members in the current project
 
Protected         protected                    All members in the current class and in
                                               classes derived from this member's class.
                                               Can be used only in member definitions, not
                                               for class or module definitions.
                                              
Protected Friend protected internal           All members in the current project and all
                                               members in classes derived from this mem-
                                               ber's class. Can be used only in member def
                                               initions, not for class or module definitions.
                                              
Private           private                      Members of the current class only.
 
 
INHERITANCE
VB                C#                           USE TO
Inherits          derivedclass : baseclass     Base on class on another, inheriting
                                               members from the base class
 
Overridable       virtual                      Declare that a member of the base class
                                               can be overridden in a derived class
 
Overrides         override                     Declare that a member of a derived class
                                               overrides the member of the same name in
                                               the base class
 
Shadows           new                          Declare taht a member of a derived class
                                               hides the member of the same name in
                                               the base class
 
MustInherit       abstract                     Declare that a class provides a template
                                               for derived classes. This type of class is
                                               called an ABSTRACT Class, and it can't be
                                               instantiated.
 
MustOverride      abstract                     Declare that a member of a class provides
                                               a template for derived members. This type of
                                               member is called an ABSTRACT member, and it
                                               can't be invoked.
 
MyBase            base                         Call a base class member from within the
                                               derived class.
 
Me                this                         Call a member of the current instance of a
                                               class
 
Interface         interface                    Create an interface that defines the
                                               members a class must provide
 
Implements        classname : interfacename    Use an interface definition in a class
 
             sealed                 Class cannot be inherited