11-10-2018, 05:07 AM
Did we talk about Inheritance before? (checking....) Oh, wow! I did, at the beginning of Page 2! Lemme 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.....
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:
Of course, you'll see that the Child classes have that goofy < Game_Battler after the class's name is defined:
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??????
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??????