From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, WEIRD_PORT autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.66.97.40 with SMTP id dx8mr74039844pab.33.1451846417849; Sun, 03 Jan 2016 10:40:17 -0800 (PST) X-Received: by 10.182.40.227 with SMTP id a3mr580008obl.14.1451846417813; Sun, 03 Jan 2016 10:40:17 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!mv3no25038308igc.0!news-out.google.com!f6ni42150igq.0!nntp.google.com!mv3no25038307igc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 3 Jan 2016 10:40:17 -0800 (PST) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:18f:900:8350:ba86:87ff:fed6:5907; posting-account=3pYsyQoAAACcI-ym7XtMOI2PDU8gRZS5 NNTP-Posting-Host: 2601:18f:900:8350:ba86:87ff:fed6:5907 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <7dcd49f3-b04f-4ea3-b431-5c27f73b9afe@googlegroups.com> Subject: Instantiating package problems From: Andrew Shvets Injection-Date: Sun, 03 Jan 2016 18:40:17 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:28996 Date: 2016-01-03T10:40:17-08:00 List-Id: Hi all, This is coming from the perspective of someone that has far more C++ OOP ex= perience. Basically, what I'm trying to do is create an instance of a pack= age and then call a function from that object. This is what I have below. = The calculator package is a simple package with the Addition function (whi= ch, you guessed it, just adds numbers together) that takes two integers and= returns an integer. I think I'm not quite getting this right or I've misunderstood something. = Here is my code so far and the results that I get when I compile it. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D with Ada.Text_IO; with Calculator; procedure Main is Calc : Calculator; begin ... Ada.Text_IO.Put_Line(" Addition: " & Integer'Image(Calc.Addition(52= , 31))); Ada.Text_IO.New_Line; end Main; OUTPUT:$ gnatmake -g main.adb calculator.adb gcc -c -g main.adb main.adb:10:10: subtype mark required in this context main.adb:10:10: found "calculator" declared at calculator.ads:5 main.adb:22:60: invalid prefix in selected component "Calc" gnatmake: "main.adb" compilation error =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D