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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,af92cb4b0cc736af X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-01 05:13:53 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.cwix.com!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!uunet!sac.uu.net!lore.csc.com!baen1673807.greenlnk.net!baen1673807!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: problem with abstract types Date: 01 Nov 2002 12:05:08 +0000 Organization: Alenia Marconi Systems, ISD, Farlington Sender: sjw@galadriel.frlngtn.gecm.com Message-ID: References: <3DC12CFF.EC36842C@brighton.ac.uk> <3DC165F9.9000000@attbi.com> <8nmtpa-pd1.ln@uli.uli-eckhardt.de> NNTP-Posting-Host: 20.44.240.6 X-Trace: lore.csc.com 1036156182 8303 20.44.240.6 (1 Nov 2002 13:09:42 GMT) X-Complaints-To: abuse@news.csc.com NNTP-Posting-Date: Fri, 1 Nov 2002 13:09:42 +0000 (UTC) X-Newsreader: Gnus v5.5/Emacs 20.3 X-Original-NNTP-Posting-Host: galadriel.frlngtn.gecm.com X-Original-Trace: 1 Nov 2002 13:09:18 GMT, galadriel.frlngtn.gecm.com Xref: archiver1.google.com comp.lang.ada:30283 Date: 2002-11-01T12:05:08+00:00 List-Id: Ulrich Eckhardt writes: > Robert I. Eachus wrote: > > with registry; use registry; > > procedure main is > > declare > > reg := openRegistry(CLASS_USER,"registrytest"); > > It's not so easy. My function get_Registry sould estimat what > type of registry should be used (mybe i want to add later on > also an LDAP, Database or some sort of pluggable support). So it > seems that i have to use access parameters for this. Reg was of type (access to) Registry'Class, which means that the actual value can be of whichever type you decide at run time. But to make this work you have to do things the right way: the "proper" idiom is to initialize using a function, declare Reg : Registry'Class := Open_Registry (...); begin where you might need to include some indication of what sort of registry to choose in the parameters to Open_Registry. Often people use strings. This is a classic example of the Factory pattern ..