Re: Ada-Singleton-Why does it work like this?
- From: "Jeffrey R. Carter" <spam.jrcarter.not@xxxxxxxxxxxx>
- Date: Tue, 24 Mar 2009 20:47:50 GMT
patrick.gunia@xxxxxxxxxxxxxx wrote:
Hi all,
I´m currently working on implementing several design patterns in Ada,
and I found some code concerning the Singleton-pattern when searching
through the posts of this group. I used this code and it all worked as
expected. My problem is, that I don´t ave any idea, why it does...here
is my code:
package Singleton is
type Singleton_Type (<>) is tagged limited private;
type Singleton_Access is access all Singleton_Type;
function return_Single return Singleton_Access;
procedure setValues(input : in out Singleton_Access; valueIN :
Integer; valueIN2 : Integer);
procedure print_something(input : Singleton_Access);
private
type Singleton_Type is tagged limited record
value : Integer;
value2 : Integer;
end record;
end Singleton;
This is a very poor solution to the problem. A much simpler solution is
package Singleton is
procedure Set (Value_1 : in Integer; Value_2 : in Integer);
procedure Print;
end Singleton;
--
Jeff Carter
"We use a large, vibrating egg."
Annie Hall
44
.
- Follow-Ups:
- Re: Ada-Singleton-Why does it work like this?
- From: sjw
- Re: Ada-Singleton-Why does it work like this?
- From: Martin
- Re: Ada-Singleton-Why does it work like this?
- References:
- Ada-Singleton-Why does it work like this?
- From: patrick.gunia@xxxxxxxxxxxxxx
- Ada-Singleton-Why does it work like this?
- Prev by Date: Re: Ada as a first language
- Next by Date: Ada Lovelace Day
- Previous by thread: Re: Ada-Singleton-Why does it work like this?
- Next by thread: Re: Ada-Singleton-Why does it work like this?
- Index(es):
Relevant Pages
|