John,
and neither is the overrated argument of being OOP ( which I
could do basically in VB6 anyway). There must be a positive somewhere.
Ah! there's the rub!
Remember an OO language supports the following 4 concepts:
1. Abstraction - ability to define new types (Classes, VB.NET Structures &
VB6 Types)
2. Encapsulation - ability to add "behavior" to new types (Sub, Function, &
Property or Classes)
3. Polymorphism - ability to use the same expression to denote different
operations (see below)
4. Inheritance - ability to define one type based on another (the new
Inherits keyword)
VB6 only allows you to do "basic" OO, it only partially allows the first
three Abstraction, Encapsulation & Interface Inclusion Polymorphism. It only
allows encapsulation on Classes & not Types.
While VB.NET allows you to do "full" OO, it supports all four with varying
levels for #3 (depending on version!).
In addition to Abstraction, Encapsulation & Interface Inclusion Polymorphism
that VB6 supports.
It allows: Inheritance, Inheritance Inclusion Polymorphism, Overloading
Polymorphism. VB.NET 2005 (aka Whidbey, due out later in 2005) will add
Custom Coercion Polymorphism (Operator Overloading) & Parametric
Polymorphism (Generics).
It allows Structures to encapsulate any behavior by allowing Subs,
Functions, Properties & Events to be added to a Structure in addition to a
Class.
So yes, VB6 supports a very basic (very limited) level of OO, while VB.NET
(especially in VB.NET 2005) supports a significantly greater level of OO.
*NOTE: Both VB6 & VB.NET support late binding which is a form of
polymorphism, that a number of OO languages (except possibly Smalltalk) do
not support.
Polymorphism definitions taken from:
http://www.javaworld.com/javaworld/jw-04-2001/jw-0413-polymorph.html
1: Coercion - a single abstraction serves several types through conversion
2: Overloading - a single identifier denotes several abstractions
3: Parametric - an abstraction operates uniformly across different types
4: Inclusion - an abstraction operates through an inclusion relation
Within VB.NET the math operators are examples of coercion polymorphism. You
can use the + operator on two integers to add them, you can also use the +
operator on singles & doubles which also adds them. In other words the +
operator is 'overloaded' for different built-in types. While C# allows
developers to define overload operators. VB.NET needs to wait for Whidbey
(VS.NET 2005) for operator overloading.
Within VB.NET we are allowed to overload members (overloading polymorphism)
within a single type as long as the parameter signatures are unique. Across
types we are free to overload members irregardless of signatures. Of course
VB.NET does define certain rules for overloading such as you cannot have a
function & a field with exactly the same name. ;-)
We will need to wait for Whidbey (VS.NET 2005) to gain Parametric
Polymorphism (a.k.a Generics).
Within VB.NET Inclusion polymorphism is subtype polymorphism. Using Inherits
or Implements to define a type that is also another type (where type is a
Class, Structure, or Interface). Normally when developers are talking
Polymorphism they are referring to this type of Polymorphism. NOTE: VB.NET
supports both Inherits & Implements while VB6 only supports Implements.
Whidbey information taken from:
http://msdn.microsoft.com/vstudio/productinfo/roadmap.aspx
http://lab.msdn.microsoft.com/vs2005/
Hope this helps
Jay