comp.lang.ada
 help / color / mirror / Atom feed
* Why default values not taken?
@ 2001-06-12 14:53 M. A. Alves
  2001-06-12 15:04 ` Tucker Taft
  2001-06-12 15:48 ` Jeffrey Carter
  0 siblings, 2 replies; 3+ messages in thread
From: M. A. Alves @ 2001-06-12 14:53 UTC (permalink / raw)
  To: comp.lang.ada

I want to create an object with only some components different from their
default values e.g.

  Contact_Person := new Text_Item'(Remark => US("name and email"));

where Text_Item inherits Remark from Input_Item and adds Text, both 
defaulting to Null_Unbounded_String:

  type Input_Item is tagged record
    Remark: Unbounded_String;
  end record;

  type Text_Item is new Input_Item with record
    Text: Unbounded_String;
  end record;

Of course I get the compile error "no value supplied for component Text".

But do I really have to supply values for all components?  What is the
best idiom here?

Thanks,

-- 
   ,
 M A R I O   data miner, LIACC, room 221   tel 351+226078830, ext 121
 A M A D O   Rua Campo Alegre, 823         fax 351+226003654
 A L V E S   P-4150 PORTO, Portugal        mob 351+939354002




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-06-12 15:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-12 14:53 Why default values not taken? M. A. Alves
2001-06-12 15:04 ` Tucker Taft
2001-06-12 15:48 ` Jeffrey Carter

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