comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison<dennison@telepath.com>
Subject: Re: Package Question [Newbie]
Date: Fri, 06 Jul 2001 13:49:25 GMT
Date: 2001-07-06T13:49:25+00:00	[thread overview]
Message-ID: <Flj17.9481$Kf3.104271@www.newsranger.com> (raw)
In-Reply-To: ssoakt067vi6drpdjatvp23qjqm94a7gak@4ax.com

In article <ssoakt067vi6drpdjatvp23qjqm94a7gak@4ax.com>, JM says...
>I'm still very green wrt to Ada but after looking at few tutorials a
>have a couple of quick questions/observations. My background is C++ so
>I'm grasping for commonalities.
>
>1. It  looks as though basically the package is a class?

No. The closest analog in C++ is the "namespace" feature.

The closest analog Ada has for a C++ class is a tagged type inside a package
(you need both).

>2.  And from a C++ point of view the package procedures are static
>functions that operate on references to the package? So basically
>'this' doesn't exist?

No. Probably the best analogy is to a (non class-based) function inside a
namespace.

It is true however, that "this" doesn't exist. When you are calling dispatching
operations in Ada, the object that is dispatched on (actually, there can be more
than one), is passed in just like any other parameter. If it makes you
comfortable, you could always name the parameter "This". :-)


It would probably be best to forget about C++ while you are learning Ada. There
are some situations where you will find parallels, but it will mostly just
mislead you. This is particularly the case with string handling, because Ada's
string philosophy is *very* different from C's. I think Ada's way is more
powerful (and certianly faster). But people who insist on using Ada strings the
C way get very frustrated.


---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



  parent reply	other threads:[~2001-07-06 13:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-06  7:06 Package Question [Newbie] JM
2001-07-06 10:59 ` Package Question [Newbie] (in C++ terms) Larry Kilgallen
2001-07-06 12:54 ` Package Question [Newbie] Marc A. Criley
2001-07-06 13:49 ` Ted Dennison [this message]
2001-07-06 13:54 ` DuckE
2001-07-06 14:13 ` Marin David Condic
2001-07-06 15:42 ` JM
2001-07-10  0:23 ` Keith Thompson
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox