Your full service technology partner! 
-Collapse +Expand
To/From Code
-Collapse +Expand Cross Ref Guide
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesVB.Net  Print This     

Abstraction (VB.Net and C++ Cross Reference Guide)

By Mike Prestwood

VB.Net versus C++: A side by side comparison between VB.Net and C++.

OOP Details

More object oriented (OO) stuff.


[Other Languages] 

General Info: Abstract Class / Abstract Member

An abstract class member is a member that is specified in a class but not implemented. Classes that inherit from the class will have to implement the abstract member. Abstract members are a technique for ensuring a common interface with descendant classes. An abstract class is a class you cannot instantiate. A pure abstract class is a class with only abstract members.

Languages Focus

Abstraction is supported at various levels with each language. A language could enforce abstraction at the class level (either enforcing a no-instantiation rule or a only abstract members rule), and with class members (member methods and/or properties).

VB.Net:   MustInherit, MustOverride, Overrides

VB.Net supports abstract class members and abstract classes using the MustInherit and MustOverride modifiers.

An abstract class is indicated with a MustInherit modifier and is a class with one or more abstract members and you cannot instantiate an abstract class. However, you can have additional implemented methods and properties.

An abstract member is either a method (implicitly virtual), property, indexer, or event in an abstract class. You can add abstract members ONLY to abstract classes using the MustOverride keyword. Then you override it in a descendant class with Overrides.

Syntax Example:
Public MustInherit Class Cyborg
  Public MustOverride Sub Speak(ByVal pMessage As String)
End Class

Public Class Series600
  Inherits Cyborg

  Public Overrides Sub Speak(ByVal pMessage As String)
  End Sub
End Class
C++:   =0 in a virtual method

AbstractMemberFunction is a pure virtual function makes this class Abstract class indicated by the "=0"and NonAbstractMemberFunction1 is a virtual function.

Syntax Example:
class AbstractClass {
virtual void AbstractMemberFunction() = 0;
  virtual void NonAbstractMemberFunction1();


   Contact Us!
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675


Go ahead!   Use Us! Call: 916-726-5675 

©1995-2018 Prestwood IT Solutions.   [Security & Privacy]