[fpc-pascal]OOP for dummies...

Keith Bowes keith_bowes at hotmail.com
Fri Jun 15 04:28:49 CEST 2001

> Sorry for the large post. And my apologies if this is a simple question,
> but it sure stumps me.
> The following is for Win32 and Go32 on a machine running Win2K Pro and FPC
> 1.0.4...
> I'm attempting, for the first time, to use object oriented programming.
> Yes, I'm ashamed to admit it, but it's true. Up until recently I never
> thought I needed OOP, but the more I read about it the more I think that
> perhaps I might benefit from it. And speaking of reading... before anyone
> asks, yes I've read the docs on classes and objects -- a few times
> -- but I can't seem to grasp all the concepts, so I'm going to post this
> hopes someone can point me in the right direction.
> I'm trying to create my own dynamic array. Well, it's actually more like a
> dynamic array of records (I know dynamic arrays are coming in the next
> version of the compiler, but this is something I've been struggling with
> for a while so I want to see if I can solve my problem now). Basically, I
> want to be able to read a file into memory and have it stop only when I
> out of memory and not when I've reached the limit of my array (array
> [1..whatever] of ^ToRecordType).
> My research indicates that a class called TCollection has the possibility
> of doing what I want, but I can't figure out exactly how to do it. The
> attached examples programs both compile but do virtually nothing. One uses
> objects, the other classes. If someone has a few moments I would really
> appreciate it they could take a look and see what I'm doing wrong.

OK, I've looked at your class sample (not the object one though, since I
don't know much about objects).  The biggest problem I see is in your
file-reading loop; the Data field always contains the content of the last
line.  The updated file contains a loop that seems to read my sample text
file fine, as well as a few other minor changes.

> TIA.
> Jim
-------------- next part --------------
A non-text attachment was scrubbed...
Type: application/octet-stream
Size: 2641 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20010614/a44f3b18/attachment.obj>

More information about the fpc-pascal mailing list