Skip to main content
Participant
July 6, 2021
Answered

Transfer a variable from the Main Class file to the Class file of an Object

  • July 6, 2021
  • 1 reply
  • 273 views

Hello,

 

I would like to know if someone can help me with this question.

I want to transfer the value of a variable from the main class file to the class file of an object. How can I access the value of the variable in the main class from within the object class file?

Thanks for helping with this question.

 

Franciska Du Toit

 

 

    This topic has been closed for replies.
    Correct answer ClayUUID

    Just write a public "getter" function in the main class that returns the value of the variable.

    1 reply

    ClayUUIDCorrect answer
    Legend
    July 6, 2021

    Just write a public "getter" function in the main class that returns the value of the variable.

    Participant
    July 7, 2021

    Thanks ClayUUID - that was the help I needed.