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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,63fa88e2f1a3ebea X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!solnet.ch!solnet.ch!news-zh.switch.ch!switch.ch!news.hispeed.ch!linux2.krischik.com!news From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Universal type in Ada Date: Sun, 19 Jun 2005 19:26:55 +0200 Organization: Cablecom Newsserver Message-ID: <2657655.BxtCfPVpWy@linux1.krischik.com> References: NNTP-Posting-Host: 84-73-3-177.dclient.hispeed.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.hispeed.ch 1119253538 2098 84.73.3.177 (20 Jun 2005 07:45:38 GMT) X-Complaints-To: news@hispeed.ch NNTP-Posting-Date: Mon, 20 Jun 2005 07:45:38 +0000 (UTC) User-Agent: KNode/0.9.0 Xref: g2news1.google.com comp.lang.ada:11492 Date: 2005-06-19T19:26:55+02:00 List-Id: zw wrote: > Hi, I am trying to create a Universal type in Ada such as "Object" in > Java so that I could define a function that returns a value in this > Universal type, then I could lower-cast value in this type to its > specific type such as String, Float or any user-defined types. Because > in Java if a method returns an Object, it could be casted to any other > types that are subtypes of Object. In Ada you don't usually "cast" types you convert them. Read the article about type conversions: http://en.wikibooks.org/wiki/Programming:Ada:Subtypes#Converting_Data > Is there a Universal type in Ada? > Could anyone tell me how to create such types in Ada, please? A tagged type will do: http://en.wikibooks.org/wiki/Programming:Ada:OO Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com