Another Bad Practice!?
It's Never Enough for Alias!
It's Never Enough for Alias!
Recently, a certain

Code:
class A
def print_intro
print "I am the A class!\n"
end
end
class B < A
alias :print_new_intro :print_intro
def print_intro
print_new_intro
print "I am the B class!\n"
end
end
a = A.new
a.print_intro
b = B.new
b.print_intro
I was under the impression that it should fail immediately, BUT the thing is that it is ALLOWED by

Just make sure you have declared the parent class properly. (You only need to do that ONCE in the script editor per child class.)
Thus, alias lets you alter both the child class or its parent class, mainly depending on which one you think it truly needs the aliasing. In this case B's parent class is A but we aliased it in the child class B.
Nonetheless, aliasing a parent class method when we already know that super method already exists and does the job without the issues alias experiences after a F12 reset, makes it totally illogical from a practical gamer's or developer's viewpoint.




Code:
class B
def print_intro
super
print "The name's B class!\n"
end
end
b.print_intro
If you ever thought that it would simply replace the B class's code above, you were right about that!

B's introduction has totally changed now.

That's exactly the moment when things can get a bit ugly.

Code:
class B
alias :print_new_intro2 :print_intro
def print_intro
print_new_intro2
print "B, Class B...\n"
end
end
b.print_intro
Here you will see how our same old friend B class now prints A class's and B class's introductions plus the brand new one where it pretends to be some sort of scripted version of James Bond.
![[Image: sweathappy.gif]](https://www.save-point.org/images/smilies/ejlol/sweathappy.gif)
And yes, some times that would be the ideal outcome... unless you just pretended to call the parent method and not one of the previous definitions of the child method.

"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.
![[Image: SP1-Scripter.png]](https://www.save-point.org/images/userbars/SP1-Scripter.png)
![[Image: SP1-Writer.png]](https://www.save-point.org/images/userbars/SP1-Writer.png)
![[Image: SP1-Poet.png]](https://www.save-point.org/images/userbars/SP1-Poet.png)
![[Image: SP1-PixelArtist.png]](https://www.save-point.org/images/userbars/SP1-PixelArtist.png)
![[Image: SP1-Reporter.png]](https://i.postimg.cc/GmxWbHyL/SP1-Reporter.png)
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.
![[Image: SP1-Scripter.png]](https://www.save-point.org/images/userbars/SP1-Scripter.png)
![[Image: SP1-Writer.png]](https://www.save-point.org/images/userbars/SP1-Writer.png)
![[Image: SP1-Poet.png]](https://www.save-point.org/images/userbars/SP1-Poet.png)
![[Image: SP1-PixelArtist.png]](https://www.save-point.org/images/userbars/SP1-PixelArtist.png)
![[Image: SP1-Reporter.png]](https://i.postimg.cc/GmxWbHyL/SP1-Reporter.png)
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