Re: time / update problem

Colnet Dominique <[email protected]> Wed, 20 Jul 2005 10:39:31 +0200
Newsgroups gmane.comp.lang.eiffel.smalleiffel
Message-ID <[email protected]>
Cheng-Chang Wu wrote:
>>
> But with default_create we always get the same
> initial value, There is no way to change that value
> because the class is immutable.
I guess that what you need is in the following attached example.
We should add such an example in our Grand Book.
-- 
--------------------------------------------------------------
[email protected] -- IUT (Nancy 2) -- INRIA Lorraine
http://SmartEiffel.loria.fr  --  The GNU Eiffel Compiler
POST: Loria, B.P. 239,54506 Vandoeuvre les Nancy Cedex, FRANCE
Voice:+33 0383913140 Mobile: +33 0665362381 Fax:+33 0383581701
my_expanded.e (text/plain, 197 B)
expanded class MY_EXPANDED

creation {ANY}
	default_create, new

feature
	attribute: CHARACTER

feature {}
	new (a: like attribute) is
		do
			attribute := a
		ensure
			attribute = a
		end
		
end
test_my_expanded.e (text/plain, 370 B)
class TEST_MY_EXPANDED
-- Compile and browse using our debugger: se c -sedb test_my_expanded
creation
	main

feature
	main is
		local
			my_expanded: MY_EXPANDED
		do
			-- You can also redefine `default_create' to change the 
			-- default for `my_expanded'. 
			my_expanded := create {MY_EXPANDED}.new('a')
			my_expanded := create {MY_EXPANDED}.new('b')
		end

end