Siletrea Wrote:hmm the "super" statements... its like small bakesale!
the original list of items for sale would be muffins and cupcakes and brownies! BUT somewhere down the line a new seller in the bakesale comes in with cookies and tarts! instead of going to the computer and building up a whole new list from scratch and then having to print everything out and replace the old sign they just take a pen and add the new items on at the bottom of the list!
right?
$save_point.members << @Siletrea << @Kyonides
Girls.add(@siletrea, @another_girl)
Those lines would be quite similar to what you described above, even if they handle people or cats.
Continuing with your bakery example...
Code:
class Business
def initialize
@open_store = true
end
def prepare_products
@list_of_available_products = [ ]
end
end
Code:
class FlourDistribuitor < Business
def prepare_products
super
@list_of_available_products << "Flour"
end
def deliver_product
@received_phone_call = true
@loaded_truck = true
@drive_off_to_bakery = true
@leave_flour_there = true
end
end
Code:
class Bakery < Business
def prepare_products
super
@list_of_available_products << "Last Bread" << "Last Muffin"
@new_list_of_ingredients = ["Flour", "Sugar"]
@clean_tools = true
end
def call_flour_distributor
@call_flour_distributor = true
@send_them_list_of_ingredients = true
end
end
Code:
@flour_distributor = FlourDistributor.new
@puma_bakery = Bakery.new
@puma_bakery.prepare_products #=> Siletrea finds out she needs more flour!
@puma_bakery.call_flour_distributor #=> She calls the flour distributor then
@flour_distributor.prepare_products
@flour_distributor.deliver_product
As you can see both the flour distributor and Puma's Bakery are businesses so they both need to do one thing in common, to prepare their products for distribution or sale at the store. There we called super to let both of them create a new list of products available at the time. It's like a distributor and a bakery sharing the same purchase / stock software like some basic system based on Excel? to make lists. Take into account that both have their own procedures meaning they don't need to do the same steps another business did. So super allowed us to complete a series of required steps to keep both businesses running smoothly.
"For God has not destined us for wrath, but for obtaining salvation through our Lord Jesus Christ," 1 Thessalonians 5:9
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE
Maranatha!
The Internet might be either your friend or enemy. It just depends on whether or not she has a bad hair day.
My Original Stories (available in English and Spanish)
List of Compiled Binary Executables I have published...
HiddenChest & Roole
Give me a free copy of your completed game if you include at least 3 of my scripts!
Just some scripts I've already published on the board...
KyoGemBoost XP VX & ACE, RandomEnkounters XP, KSkillShop XP, Kolloseum States XP, KEvents XP, KScenario XP & Gosu, KyoPrizeShop XP Mangostan, Kuests XP, KyoDiscounts XP VX, ACE & MV, KChest XP VX & ACE 2016, KTelePort XP, KSkillMax XP & VX & ACE, Gem Roulette XP VX & VX Ace, KRespawnPoint XP, VX & VX Ace, GiveAway XP VX & ACE, Klearance XP VX & ACE, KUnits XP VX, ACE & Gosu 2017, KLevel XP, KRumors XP & ACE, KMonsterPals XP VX & ACE, KStatsRefill XP VX & ACE, KLotto XP VX & ACE, KItemDesc XP & VX, KPocket XP & VX, OpenChest XP VX & ACE