ZScript extend clarification
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
-
- Posts: 72
- Joined: Sat Jul 05, 2014 7:38 am
ZScript extend clarification
ZScript supports inheritance just like DECORATE does, but what exactly is the difference with the extend keyword?
-
-
- Posts: 3800
- Joined: Sun Aug 07, 2011 4:32 am
Re: ZScript extend clarification
Like the name implies extend allows to add functions to already existing class without altering its definition.
It’s possible to define a class in multiple files for example. This feature has nothing to do with inheritance.
It’s possible to define a class in multiple files for example. This feature has nothing to do with inheritance.
-
- Posts: 72
- Joined: Sat Jul 05, 2014 7:38 am
Re: ZScript extend clarification
And what's the difference between that and inheriting and replacing a class?
-
-
- Posts: 3800
- Joined: Sun Aug 07, 2011 4:32 am
Re: ZScript extend clarification
Check extension of StateProvider class for almost every weapon in GZDoom core ZScript lumps.
How do you suppose to achieve this with class replacement?
How do you suppose to achieve this with class replacement?