Can properties of the same class in python call their own methods?

I want to implement a function:

class FooBar():
    def __init__(self):
        self.foobar = foobar
    def foo(self):
        pass
    def bar(self):
        pass

a = Foobar()

after obtaining instance a, you can use the bar () method:

a.bar()

now, I want to let the foobar property and foo () method of an also use the bar () method:

a.foobar.bar()
a.foo().bar()

could you tell me how to write this? thank you

Mar.20,2021

classmethod and staticmethod learn about


you may have problems with object-oriented understanding

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35fe3-2bfbe.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35fe3-2bfbe.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?