Can a standalone procedure in Ada have the same name as a procedure within a package? |
[Edit] |
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;
First answer by ID1032960443. Last edit by Jcreem. Contributor trust: 51 [recommend contributor]. Question popularity: 18 [recommend question]
|
Research your answer: |



