creating own Image function
From: R (ruthless_at_poczta.onet.pl)
Date: 12/29/04
- Next message: Samuel Tardieu: "Re: Private area and child packages"
- Previous message: R: "overloading operators with private variables"
- Next in thread: Vinzent 'Gadget' Hoefler: "Re: creating own Image function"
- Reply: Vinzent 'Gadget' Hoefler: "Re: creating own Image function"
- Reply: Mark Lorenzen: "Re: creating own Image function"
- Reply: Bobby D. Bryant: "Re: creating own Image function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 29 Dec 2004 08:51:43 -0800
Hello.
I've written my own Image function it's sth like Java's toString.
function Image(this: rec1) return String is
tmp : String(1..26);
begin
tmp := "The value of field is:" & Integer'Image(Get(this));
return tmp;
end Image;
when I use it:
testclass.Create(object, 100); -- note 100 is 3 digits = 3 Characters
Put(testclass.Image(object));
then I can see "The value of field is: 100"
when I initiate my object with 10 - 2 digits = 2 Characters
an exception is raised:
CONSTRAINT_ERROR : testclass.adb:34 length check failed
it's because tmp: Sting has it's fixed length can it be more flexible?
When I tried with String(1..100) the same effect
users can initate their objects with 1, 11, 111, 111111 and so on.
so my question is: can I write(with Your help of course) a function
flexible
to handle all those situations?
thanks in advnce
best regards R
- Next message: Samuel Tardieu: "Re: Private area and child packages"
- Previous message: R: "overloading operators with private variables"
- Next in thread: Vinzent 'Gadget' Hoefler: "Re: creating own Image function"
- Reply: Vinzent 'Gadget' Hoefler: "Re: creating own Image function"
- Reply: Mark Lorenzen: "Re: creating own Image function"
- Reply: Bobby D. Bryant: "Re: creating own Image function"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|