Recursive data types in VB? 
Author Message
 Recursive data types in VB?

I'm curious if it is possible to have recursive classes in VB, and If
so how.  I'm use to C/C++ where you simply declare a pointer to the
same type as itself.

As an example I was thing of coming up with classes for a hard
drive.

Drive
  |
  +-- Directories
       |   |
       |   |
       |   +--- Directories
       |           |   |
       +-- Files   |   |
                   |   +--- Directories
                   |
                   +-- Files

Other then being a good example for learning I probably wouldn't use
this for any thing else...

Thanks in advance.

Dano :)

** If you "Reply" to this message please remove "nospam" from my return
reply address.



Sun, 27 Aug 2000 03:00:00 GMT  
 Recursive data types in VB?

You would not need 1st order recursion for your example.
You would have one instance of 2nd order recursion.

You would have a class for drive, folder and file and collection classes for
drives, folders and files.

Drives contains a collection of Drive
Drive contains a Folders property
Folders contains a collection of Folder
Folder contains a Folders property and a Files property
Files contains a collection of File
File contains the data about a file

Regards,
Simon Jones
PC Pro Magazine



Mon, 28 Aug 2000 03:00:00 GMT  
 Recursive data types in VB?

Thanks for the reply.  I like the abstraction you have for the drive,
dir and file.  While I'm actually interested in using a recursive data
type.  I was using the drive, directory, and files as an example for a
data type which may be recursive.  Say if I change to a data type which
is often easier to represent/process as a recursive data type such as a
linked list or other tree structures?  My main interest is to learn how
to do a recursive data type in VB and go through the issues of what it
takes and how to process them in VB.

Thanks again for you input and have a GREAT Day.

Dano :)

Quote:

> You would not need 1st order recursion for your example.
> You would have one instance of 2nd order recursion.

> You would have a class for drive, folder and file and collection classes for
> drives, folders and files.

> Drives contains a collection of Drive
> Drive contains a Folders property
> Folders contains a collection of Folder
> Folder contains a Folders property and a Files property
> Files contains a collection of File
> File contains the data about a file

> Regards,
> Simon Jones
> PC Pro Magazine

--

Dan Doris

www.logoscomputer.com
3801 14th. Ave. W.
Seattle, WA  98119

** If you "Reply" to this message please remove "nospam" from my return
reply address.



Mon, 28 Aug 2000 03:00:00 GMT  
 Recursive data types in VB?

Any one interested in this  I found an example for this a linklist in
the Advance Visual Basic Book from Microsoft Press. The book is a bright
orange color.

Quote:

> Thanks for the reply.  I like the abstraction you have for the drive,
> dir and file.  While I'm actually interested in using a recursive data
> type.  I was using the drive, directory, and files as an example for a
> data type which may be recursive.  Say if I change to a data type which
> is often easier to represent/process as a recursive data type such as a
> linked list or other tree structures?  My main interest is to learn how
> to do a recursive data type in VB and go through the issues of what it
> takes and how to process them in VB.

> Thanks again for you input and have a GREAT Day.

> Dano :)


> > You would not need 1st order recursion for your example.
> > You would have one instance of 2nd order recursion.

> > You would have a class for drive, folder and file and collection classes for
> > drives, folders and files.

> > Drives contains a collection of Drive
> > Drive contains a Folders property
> > Folders contains a collection of Folder
> > Folder contains a Folders property and a Files property
> > Files contains a collection of File
> > File contains the data about a file

> > Regards,
> > Simon Jones
> > PC Pro Magazine

> --

> Dan Doris

> www.logoscomputer.com
> 3801 14th. Ave. W.
> Seattle, WA  98119

> ** If you "Reply" to this message please remove "nospam" from my return
> reply address.

  vcard.vcf
< 1K Download


Fri, 01 Sep 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Recursive data types.

2. C data type vs. VB Data type

3. VB Data Types - C Data Types

4. how to declare recursive type in VB?

5. Does VB a similar data type like the C++ Union type

6. Does VB a similar data type like the C++ Union type

7. problem of converting C's union type to VB's a data type

8. problem of converting C's union type to VB's a data type

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

10. Data type conversion error when saving numeric data types

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

12. ADO data types and vbasic data types mapping

 

 
Powered by phpBB® Forum Software