Verse Library verse

11 Access Specifiers

Illustrates controlling class visibility within modules, restricting constructor access, and handling scope errors.

extracted-snippets/documentation/en-us/uefn/class-in-verse/11-access-specifiers.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/class-in-verse
# Local doc:  epic-docs/documentation/en-us/uefn/class-in-verse.md
# Section:    Access Specifiers
pets := module:
    cat<public> := class<internal>:
        Sound<public> : string = "Meow"

GetCatSound(InCat:pets.cat):string =
    return InCat.Sound # Valid: References the cat class but does not call its constructor

MakeCat():void =
    MyNewCat := pets.cat{} # Error: Invalid access of internal class constructor
Copy full snippet

Comments

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