Re: Basic Explaination of OO in Ada
- From: Robert A Duff <bobduff@xxxxxxxxxxxxxxxxxxxx>
- Date: 18 Sep 2006 13:51:24 -0400
richard.charts@xxxxxxxxx writes:
I'm new to Ada, having to learn it for work, and I am beginning to
understand the language, I think.
However, coming from C (and family) and Java and other "modern"
languages, I can't seem to wrap my head around Ada's OO methods. Is it
that there is simply nothing like a class in C++ or Java?
Right. The things you can do are roughly the same, but they look rather
different.
In Ada, packages are all about visibility, encapsulation, information
hiding, and so forth. Tageged and class-wide types are all about type
extension and run-time polymorphism and so forth. C++ and Java combine
all these things into one language feature -- the "class" -- whereas Ada
splits them in two.
Another unusual thing about Ada is the split between "specific type",
which represents a particular point in the type heirarchy, and
"class-wide type", which represents a whole [sub]hierarchy.
As a learning exercise, I'm trying to convert a simple Python program
to Ada.
The basics of the program were that it took in data about a Person
object(or Student or Advisor) and stored it into array for
manipulation.
At first, I kept trying to convert almost line for line to Ada. But I
couldn't build the classes in the same way.
Is the correct way to think in Ada, that in a package, there is some
record "object" and also a number of subprograms that can interact
with/on that record?
Usually, for each abstraction, you have a package containing one main
type, along with primitive operations on that type.
- Bob
.
- References:
- Basic Explaination of OO in Ada
- From: richard . charts
- Basic Explaination of OO in Ada
- Prev by Date: Re: Basic Explaination of OO in Ada
- Next by Date: Re: Basic Explaination of OO in Ada
- Previous by thread: Re: Basic Explaination of OO in Ada
- Next by thread: Re: Basic Explaination of OO in Ada
- Index(es):
Relevant Pages
|
|