Verse Library verse

01 Verse Updates And Fixes

Demonstrates base and derived classes, constructors, and field initialization order rules.

extracted-snippets/documentation/en-us/fortnite/37-50-fortnite-ecosystem-updates-and-release-notes/01-verse-updates-and-fixes.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/37-50-fortnite-ecosystem-updates-and-release-notes
# Local doc:  epic-docs/documentation/en-us/fortnite/37-50-fortnite-ecosystem-updates-and-release-notes.md
# Section:    Verse Updates and fixes
base_class := class:
# base_class fields
MakeBaseClass<constructor>() := base_class:
# base_class initializers
derived_class := class(base_class):
Field:int
MakeDerivedClass<constructor>() := derived_class:
MakeBaseClass<constructor>() # Delegating constructor call
# Error 3690: All field initializers must come before
# constructor calls in archetype instantiation.
Field := 42

Comments

    Sign in to vote, comment, or suggest an edit. Sign in