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,901038687c38f61c,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!elnk-atl-nf1!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!d9c68f36!not-for-mail From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Idiom for a class and an object in Ada Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Mon, 18 Oct 2004 11:47:56 GMT NNTP-Posting-Host: 209.165.22.232 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.atl.earthlink.net 1098100076 209.165.22.232 (Mon, 18 Oct 2004 04:47:56 PDT) NNTP-Posting-Date: Mon, 18 Oct 2004 04:47:56 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:5395 Date: 2004-10-18T11:47:56+00:00 List-Id: Suppose I have a class with one or a limited set of objects. The objects are "global" in the sense that they hang around from program startup thru the entire life of execution. An example would be an A/D Converter class - My little control box might have 3 or 4 A/Ds in it - they're always there and I want the data associated with them to be static (not declared on the stack.) Question: What is the preferred Ada idiom for defining such a creature? I have a package that defines the class - that contains the tagged type and any methods. I might: a) Declare the objects within that "class" package b) Declare the objects within some child package of the class package c) Declare the objects in some global "Here's all my static data" package (not very tidy) d) Declare the objects in the main program (not good if they are accessed by more than one task and also a kind of dumping ground) Does anybody have an opinion or experience with doing this? I know what I've done in the past, but I'm curious if there is any preferred method or idiom for this in the OO paradigm as applied to Ada? MDC -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m o d c @ a m o g c n i c . r "Power corrupts. Absolute power is kind of neat" -- John Lehman, Secretary of the Navy 1981-1987 ======================================================================