Out Parameters

An out parameter, like a variable parameter, is passed by reference. With an out parameter, however, the initial value of the referenced variable is discarded by the routine it is passed to. The out parameter is for output only; that is, it tells the function or procedure where to store output, but doesn't provide any input.

For example, consider the procedure heading procedure GetInfo(out Info: SomeRecordType);

When you call Getlnfo, you must pass it a variable of type SomeRecordType:

var MyRecord: SomeRecordType; Getlnfo(MyRecord);

But you're not using MyRecord to pass any data to the Getlnfo procedure; MyRecord is just a container where you want Getlnfo to store the information it generates. The call to Getlnfo immediately frees the memory used by MyRecord, before program control passes to the procedure.

Out parameters are frequently used with distributed-object models like COM and CORBA. In addition, you should use out parameters when you pass an uninitialized variable to a function or procedure.

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment