Can a standalone procedure in Ada have the same name as a procedure within a package?

Answer

Yes.

One could create a file called standalone.adb with the contents:

with Text_IO; procedure Standalone is begin Text_IO.Put_Line("I am so alone"); end Standalone;

and have another package in a file called package_1.ads with the contents:

package package_1 is

procedure Standalone;

end package_1;

(Not providing the body of this package in the example but obviously one is needed).

At this point, we have shown that it is possible but the next question is (maybe) how would you call them.

with Standalone; with Package_1; procedure My_Main_Program is

begin Standalone; Package_1.Standalone; end My_Main_Program;

Improve Answer Discuss the question "Can a standalone procedure in Ada have the same name as a procedure within a package?" Watch Question

First answer by ID1032960443. Last edit by Jcreem. Contributor trust: 51 [recommend contributor]. Question popularity: 18 [recommend question]

Research your answer:

Answers.com > Wiki Answers > Categories > Technology > Computers > Computer Programming > Can a standalone procedure in Ada have the same name as a procedure within a package?

Our contributors said this page should be displayed for the questions below. (Where do these come from)
If any of these are not a genuine rephrasing of the question, please help out and edit these alternates.
A procedure exists in package can same name procedure can be created as stand alone procedure?