Shop OBEX P1 Docs P2 Docs Learn Events
Main parent child object question — Parallax Forums

Main parent child object question

Don MDon M Posts: 1,652
edited 2012-10-19 10:48 in Propeller 1
Main --> object1 --> child of object1

In the above scenario can I call a method directly from the Main to the child or do I have to set up a method in object1 to call the method from the child first and then call the method in object1 from Main?

If I can call directly to the child what is the correct syntax?

Thanks.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-10-19 10:42
    Don,

    Just declare the child object in the OBJ section of Main, and you can call it directly. Keep in mind, however, that this will be a separate instance of the child object with separately-allocated VAR variables. If that's a problem, you will need to create "helper methods" in object1 to make the calls to its child for you.

    -Phil
  • Don MDon M Posts: 1,652
    edited 2012-10-19 10:48
    If that's a problem, you will need to create "helper methods" in object1 to make the calls to its child for you.

    -Phil

    Yes it would be a problem. So a "helper method" it is! Thanks Phil.
Sign In or Register to comment.