Welcome Guest Search | Active Topics | Log In | Register

access this from inner table.
#1 Posted : Wednesday, July 11, 2018 1:51:20 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 7/11/2018(UTC)
Posts: 4
Location: toronto

Thanks: 0 times
Was thanked: 0 time(s) in 0 post(s)
How do I access the instance from inner table function ?
- how do I call basefoo from do_some, passing parent class instance


class Base
    function basefoo(inst)
        print (inst.var1);

class FromBase extends Base

    some =
        function operate()
            // I dont wnt to pass this.
            // how do I call Base::basefoo  passing some, or FromBase::this
        function operate_with_o(obj)
            obj.basefoo(this);   // OK

    function do_some()
        some.operate_with_o(this);   // I dont want to pass this...


#2 Posted : Monday, July 16, 2018 8:11:10 AM(UTC)
Rank: Advanced Member

Groups: Registered
Joined: 8/23/2014(UTC)
Posts: 124
Location: Northern Germany & Lincolnshire, U.K.

Thanks: 1 times
Was thanked: 10 time(s) in 10 post(s)

see keyword "base"

e.g. base.basefoo();

(Hence, a confusing approach to actually call a class "Base" like you did in your example ;-)
#3 Posted : Saturday, July 21, 2018 6:07:11 PM(UTC)
Rank: Member

Groups: Registered
Joined: 12/27/2016(UTC)
Posts: 10

Thanks: 0 times
Was thanked: 2 time(s) in 2 post(s)
Try to use environment binding for 'operate' in class constructor:
function operate()
Remember, you have to create table in the constructor so every instance have own table and it's functions.
But so you'll not can use table's data in 'operate' - 'this' will be replaced.
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Clean Slate theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.067 seconds.