Inheritancing scenes save resources?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Covenauta

Hello, I have a dude, and I wasn’t able to find out about it, but I guess it’s true.

When you inherit, are you reusing nodes from the inherited base although with different values? (I say it because exported values can be changed on inherited scenes, and they’ll be saved with the new scene) or it’s just a comfortable way to duplicate scenes in Godot?

For example, if we create a base level and inherit it to make all levels it will be the same as duplicating that base scene many times? Or nodes would be the same but load in a different way so meanwhile duplicating increases game size, inherit will save resources because of reusing node data?

:bust_in_silhouette: Reply From: Ertain

When using the concept of inheritance, the attributes from the base class can be used and extended in subsequent classes or instances. So instead of duplicating all of the attributes of the base class, they can be directly used. More resources don’t need to be used. What’s even better is that these attributes can be used in the inherited class or instance in different ways (for example, assigning a different number to a variable so that a member function operates in different ways). Bare in mind that changing the base class also changes the inherited classes/instances.