IT SOLUTIONS
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     

Member Method (VB.Net and Delphi Prism Cross Reference Guide)

By Mike Prestwood

VB.Net versus Delphi Prism: A side by side comparison between VB.Net and Delphi Prism.

 
OOP Basics
 

Some languages support object-based concepts such as Paradox, Access, and VB Classic. Other languages have OO extensions and fully support object orientation in a hybrid fashion (such as C++ and Dephi for Win32). Finally, some lanages such as C#, VB.Net, Prism, and Java are entirely written in OO. Meaning, every line of code written must occur within a class).

Member Method

[Other Languages] 

Also known as a Class Method.

A code routine that belongs to the class or an object instance (an instance of the class). Methods that belong to the class are called class methods or static methods. Methods that belong to an object instance are called instance methods, or simply methods.

When a method returns a value, it is a function method. When no value is returned (or void), it is a procedure method.

Methods frequently use method parameters to transfer data. When one object instance calls another object instance using a method with parameters, you call that messaging.

VB.Net:   Sub, Function

VB.Net�uses the keywords sub and function. A sub does not return a value and a function does. Many programmers like to use the optional call keyword when calling a sub to indicate the call is to a procedure.

Syntax Example:

Class definition:

Public Class Cyborg
� Inherits Object
 
Public Sub IntroduceYourself()
��� MessageBox.Show("Hi, I do not have a name yet.")
� End Sub
End Class

Some event like a button click:

Dim T1 As New Cyborg
T1.IntroduceYourself()
Delphi Prism:   method, procedure, function

Prism uses the keyword method for member methods and is the preferred syntax over the legacy procedure and function keywords. Although method is preferred, you can use procedure or function if you want the compiler to make sure all functions return a value and all procedures do not.

Syntax Example:

In the interface section:

Cyborg = class(System.Object)
  public method IntroduceYourself();
end;

In the Implementation section:

method Cyborg.IntroduceYourself();
begin
  MessageBox.Show("Hi, I do not have a name yet.");
end;
 

On some event like a button click:

var T1: Cyborg;
begin
  T1 := New Cyborg;
  T1.IntroduceYourself;
end;












Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


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