a beginner question

From: mr1yh1 (mr1yh1_at_yahoo.com)
Date: 10/21/04


Date: Wed, 20 Oct 2004 19:01:47 -0400

i am very new in ada , i try to write codes from book and see result
i tried something but i couldnt get a good result
(i use gnat)

******************
with Ada.Text_Io;use Ada.Text_Io;
procedure test is
   type Sex_T is
         (Male,
          Female);

   type Person ( S:Sex_T:=Male )is
   record
      Age:Positive ;
      Sex:Sex_T:=S;------please look at here first
      case S is
         when Male =>
            Has_Wife:Boolean ;
         when Female=>
            Has_Husband:Boolean;
      end case;
   end record;--person end
   Me : Person;
   she : Person (Female); ---- and this one ,
begin
   Me:=(
      S => Male,
      Sex => Male,
      Age => 33,
      Has_Wife => True);
   she:=(
      S => Female,
      Sex => Male, ---please look at here now!!!!!
       
      Age => 23,
      Has_Husband => True);
   Put(Sex_T'Image(she.Sex));
end test;

****
there is not any alert
and result is
" male " ??

if i dont put "sex=>male" , or "sex=>female"
it dont let me to use a named association...

even is i dont put " s=> female "
it dont let me too ,
but i said about discriminant
when i declare the variable ( she : person(female) )

why its not possible ?
to put
she:=(age=>23,has_husband=>true);
 

regards



Relevant Pages

  • Re: Totally OT: Superbowl commercial, "Bobs House"
    ... i dont think even he was aware that he would indeed read lips. ... oddly enough he couldnt hear lower octave aka mens voices at all. ... one male nurse took to writing him notes when i wasnt around to translate, ...
    (rec.crafts.textiles.quilting)
  • Re: hi, new to wow
    ... used it before when i couldnt find somethin. ... i dont like rigidness, ... social interactions. ...
    (alt.games.warcraft)
  • Large size posts in Newsgroups yield lesser responses ?
    ... I dont get any responses. ... Please note the post is big not due to attachments (I have read Chip's ... sometimes there are long codes (my codes are quite unwieldy even by a ... Just to check my "theory" in outlook I sorted posts sizewise in programming ...
    (microsoft.public.excel.programming)
  • Re: Large size posts in Newsgroups yield lesser responses ?
    ... > I dont get any responses. ... > Please note the post is big not due to attachments (I have read Chip's ... > sometimes there are long codes (my codes are quite unwieldy even by a ... > on an average lesser responses compared to others. ...
    (microsoft.public.excel.programming)
  • Re: A friend brought me something from cuba ..
    ... bought in Berlin, and I've tested them with Jan Østergård ... breake open the next bottle of Zacapa:0) ... dont think are fauxhibas. ... Dr. Chino, don't worry too much about the Lanceros being fakes, the codes should be on the cardboard-box the wooden box came in. ...
    (alt.smokers.cigars)