"Ted Dennison" a �crit dans le message news: 95uda1$pq6$1@nnrp1.deja.com... > In article <95sgl4$3c8$2@wanadoo.fr>, > "Jean-Pierre Rosen" wrote: > > > Sometimes, the constructor is not able to perform the job, and you > > want to return some "null value" (I know, you can also raise an > ... > > package Abstract_Type is > > type Root_Type is abstract tagged null record; > > procedure Oper (X : Root_Type) is abstract; > > > > Null_Value : constant Root_Type'Class; > > For this system to work, all your "constructors" would have to be > functions returning something like Root_Type'Class, and their targets > would all have to be class-wide initializations or allocators, right? Or > is that some kind of unwritten standard of which I'm unaware? A slim > majority of the time when I'm "constructing" a tagged type object > there's a specific type the expression is expecting. If I were to do > that with the above system, then I'd just get Constraint_Error. The kind of constructor I was thinking about is one that, for example, reads a file and returns various objects (widgets...). If you have a syntax error, or the end of file, you may want to return a null value. I'm not saying it's applicable to everything, just that it can be useful in some cases. -- --------------------------------------------------------- J-P. Rosen (Rosen.Adalog@wanadoo.fr) Visit Adalog's web site at http://pro.wanadoo.fr/adalog