Abstract Data Types 
Author Message
 Abstract Data Types

Hi,

In a VB.NET class, I've been asked to create an Abstract Data Type. I am
just not getting the mental picture of it, so could someone show me an
example of one?

Thanks,
Brian



Sun, 27 Nov 2005 01:41:21 GMT  
 Abstract Data Types
Right from the VS.NET documentation (search for keyword ABSTRACT)

Public MustInherit Class WashingMachine
   Sub New()
      ' Code to instantiate the class goes here.
   End sub
   Public MustOverride Sub Wash
   Public MustOverride Sub Rinse (loadSize as Integer)
   Public MustOverride Function Spin (speed as Integer) as Long
End Class

The above class is Abstract because it must be inherited to utilize it, and
it has "unimplemented" methods.  This class inherits the abstract class...

Public Class MyWashingMachine
   Inherits WashingMachine
   Public Overrides Sub Wash()
      ' Wash code goes here
   End Sub
   Public Overrides Sub Rinse (loadSize as Integer)
      ' Rinse code goes here
   End Sub
   Public Overrides Function Spin (speed as Integer) as Long
      ' Spin code goes here
   End Sub
End Class

Conceptually it allows you to abstract an idea such as "Vehicle". You might
consider that all vehicles have tires, and express this as an overridable
property or method. But the implementation of tires on a motorcycle and a
fire truck would be very different.  You have to get more specific (number,
and size, etc. of tires) to be able to make a motorcycle instance. Vehicle
is not specific enough to make an object instance.

A more concrete example might be in a graphics engine. You might abstract
drawing primitives such as drawing a line, or dots, or doing fills within an
idealized set of methods. Then you might implement a specific DrawLine for a
plotter with code that differs from that of a video display, and separately
implement a derived class for a laser printer.  Applications can be
developed to work with the abastracted drawing methods of the base class,
but can instance one for the video or laser or plotter interchangably.

I would tend to think about abstraction of classes or objects rather than
"Data Type", but even a "floating point" number could be abstracted as a
mantissa and exponent, which could then be more specifically defined in
derived classes, I suppose. You dont really override data members, but you
can the properties and methods.

HTH - Lee


Quote:
> Hi,

> In a VB.NET class, I've been asked to create an Abstract Data Type. I am
> just not getting the mental picture of it, so could someone show me an
> example of one?

> Thanks,
> Brian



Sun, 27 Nov 2005 02:57:15 GMT  
 Abstract Data Types
Brian,
In addition to Lee's answer.

Check out the following section of the documentation:

Language Equivalents:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsin...

It provides topics on:
- Programming Concepts compared in Different Languages
    (with Code Examples)
- Keywords Compared in Different Languages
- Data Types Compared in Different Languages
- Operators Compared in Different Languages
- Controls & Programmable Objects Compared in Different Languages

Hope this helps
Jay


Quote:
> Hi,

> In a VB.NET class, I've been asked to create an Abstract Data Type. I am
> just not getting the mental picture of it, so could someone show me an
> example of one?

> Thanks,
> Brian



Sun, 27 Nov 2005 04:55:07 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Abstract Data Types in VB

2. Abstract Data Types in VB 2.0

3. PictureBox y-axis, VB Abstract Data Types

4. ADO to abstract data from multiple data connections

5. Get error: Disallowed implicit conversion from data type varchar to data type money

6. Data type conversion error when saving numeric data types

7. Q: variant data type with user defined data type

8. C data type vs. VB Data type

9. ADO data types and vbasic data types mapping

10. Data Type Problem accessing Btrieve (MBF) data type

11. Data Type Problem accessing Btrieve (MBF) data type

12. Data Type Problem accessing Btrieve (MBF) data type

 

 
Powered by phpBB® Forum Software