11-10-2018, 05:32 AM
(11-10-2018, 05:07 AM)DerVVulfman Wrote: Did we talk about Inheritance before? (checking....) Oh, wow! I did, at the beginning of Page 2! Lemme recap:soo essentially its like a tree...inheritance is similar to a tree...starting at one point and then using the initial script as a building block to continue without having to constantly rebuild the same thing over and over....like a tree...the hidden "Window" class is the roots with "Window_Base" as the trunk "Window_Selectable" as branches and anything else that uses the scripts pertaining to the usage of windows becomes its leaves and "Pacman" < is a way of showing that its using the previously established script as a base to work from so its not as much too type
The Recap
Did you read that again? Yes? Goodie! Cause I'm going to start using SOME terms here. You do have to learn them too, right?
When I said.....
Quote:Go and look at the 'Window_Selectable' class in your editor, and you may see this:
class Window_Selectable < Window_Base
Looks odd, no? The '< Window_Base' thingie says 'WE CHEATED!!!' We just made a whole class called Window_Selectable, and we're re-using material from Window_Base without needing to retype it!!!
Now I will talk about some terms: The Parent Class and the Child class. They probably came up with those names when they also decided to call this thingie 'Inheritance'
When I said that the Window_Selectable class is reusing material from Window_Base, it is 'inheriting' the material.... Just as a baby inherits its eyes from its mother. The Windows_Selectable class is what we call a Child class, and the Window_Base class is its parent. But just the same, the hidden Windows class is a parent class to the Windows_Base class... with Window Base being the child class.
Yeah, so whenever you have one class based on another, that new class is a child of the older parent.
So what the heck is a SUPERCLASS?????
Wait? Where did that come from? Krypton?
Nope. It's sorta just another way to refer to a Parent class. If you look at some of the default scripts like Game_Battler, they refer to themselves as being Superior to the other... a superclass:
Code:#==============================================================================
# ** Game_Battler (part 1)
#------------------------------------------------------------------------------
# This class deals with battlers. It's used as a superclass for the Game_Actor
# and Game_Enemy classes.
#==============================================================================
class Game_Battler
Of course, you'll see that the Child classes have that goofy < Game_Battler after the class's name is defined:
Code:class Game_Actor < Game_Battler
So saying that the Game_Battler class is a Parent class to the Game_Actor class, you could also say that the Game_Battler class is a superclass to the Game_Actor class.
Got it so far??????
am I getting that right? because your explanation made oodles of sense if I got that right!
new logo for Yesteryear created by Lunarberry!