I know how to fix it (see my solution @bottom) but don't understand why this compilation error occurs, as in my mind, renamed attributes should be created by the Precursor into default_create. Why isn't that so?
NRJ_ENTITY
inherit
ANY
redefine
default_create
end
feature {NONE} -- Initialization
default_create
do
create current_day
create current_month
create current_year
Precursor
end
feature -- Access
current_day,
current_month,
current_year: ENERGY_UNIT
end
NRJ_CONSUMER
inherit
NRJ_ENTITY
end
NRJ_GENERATOR
inherit
NRJ_ENTITY
end
NRJ_GENERATOR_CONSUMER
inherit
NRJ_GENERATOR
rename
current_day as current_day_generation,
current_month as current_month_generation,
current_year as current_year_generation
redefine
default_create
select
current_day_generation,
current_month_generation,
current_year_generation
end
NRJ_CONSUMER
rename
current_day as current_day_consumption,
current_month as current_month_consumption,
current_year as current_year_consumption
redefine
default_create
end
feature {NONE} -- Initialize
default_create
do
Precursor {NRJ_GENERATOR}
Precursor {NRJ_CONSUMER}
end
end
Error screenshot
Fix into NRJ_GENERATOR_CONSUMER
default_create
do
create current_day_consumption
create current_month_consumption
create current_year_consumption
Precursor {NRJ_CONSUMER}
Precursor {NRJ_GENERATOR}
end