0

I'm trying to write a program for a class. In the specifications, tasks cannot have any procedures or functions. I must use the package name to access Tasks. How can I go about doing this? Can I simply write something along the lines of

package hello is
   task sample is...
   end sample;
end hello;
bob smith
  • 35
  • 4
  • Unclear question. Still, I would say that accessing a package element (procedure, function, etc.) being exposed through the specification, would need to be of the form: `.[(params if any)]`. – FDavidov Nov 05 '16 at 19:55
  • Program Specification: There will be three (3) tasks besides the main task: Sender, Carrier, Receiver Each task must be in its own package and there must be two files per task, an ADS and an ADB. The tasks must be infinite loops. They can NOT have any procedures or functions. I don't understand how this is possible without methods. – bob smith Nov 05 '16 at 20:01
  • 1
    @bobsmith: Please [edit](http://stackoverflow.com/posts/40442524/edit) your question to add new information. As an exercise, try re-factoring this [example](http://stackoverflow.com/q/39544982/230513) into three files—one procedure (body) and one task (spec & body). – trashgod Nov 05 '16 at 20:49
  • 2
    Tasks can have entries: e.g. in the [Wikibook](https://en.wikibooks.org/wiki/Ada_Programming/Tasking#Rendezvous). – Simon Wright Nov 05 '16 at 21:10
  • 1
    Protected objects can have procedures, functions, or entries. Tasks can only have entries. When looking in your references you might want to look for words like rendezvous, entry, accept. – Jim Rogers Nov 05 '16 at 22:01

1 Answers1

1

Yes.

You would of course have to put the task body in the package body.

Jacob Sparre Andersen
  • 6,733
  • 17
  • 22