Forum > Beginners

Declaring procedure in Unit as private

<< < (2/2)

taazz:

--- Quote from: Bart on August 21, 2014, 06:31:30 pm ---
The forward declaration is not needed to"hide" the function:

--- End quote ---

No its not needed to hide the function is needed to declare it.

Bart:

--- Quote from: taazz on August 21, 2014, 07:39:52 pm ---No its not needed to hide the function is needed to declare it.

--- End quote ---

But only if the order you wrote them in is absolutely necessary.
(Which, from your example isn't clear.)

Bart

taazz:

--- Quote from: Bart on August 21, 2014, 10:26:59 pm ---
--- Quote from: taazz on August 21, 2014, 07:39:52 pm ---No its not needed to hide the function is needed to declare it.

--- End quote ---

But only if the order you wrote them in is absolutely necessary.
(Which, from your example isn't clear.)

Bart

--- End quote ---

I have no idea if it is "absolutely necessary", I'm answering a question avoiding assumptions, it is a time saver though if you are not interested in finding out if it is absolutely necessary.

Bill52:
Thank you for everybody!

I didn't know, the order of of the procedures under implementation is important.

Thanks again!

marcov:

--- Quote from: Bill52 on August 22, 2014, 10:00:29 am ---I didn't know, the order of of the procedures under implementation is important.

--- End quote ---

Pascal is strictly declare before use. So if you call a function before it is declared (either a declaration
in the interface, or code in the implementation section), you need to declare the procedure header only forward.

This is usually not done as a matter of routine. I only have an handful of forwards in my framework which are hundreds
of units. (though admitted, in OOP code you declare more, so it is less needed)

In case needed look up "forward" in the manual.

Navigation

[0] Message Index

[*] Previous page

Go to full version