Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

helpfulness, in my /prog/?

Name: Anonymous 2012-01-06 3:51

Is there a way to do this in python?  I want to have a class that gets passed or creates an object and be able to call this object's methods through the containing class, except the object can be of any class, so inheritance doesn't work.

So basically, I want this to work:


class A:
    def __init__(self, obj):
        #DO STUFF TO IMPORT obj'S METHODS

class B:
    def funcB(self):
        #DO STUFF

class C:
    def funcC(self):
        #DO STUFF

x = A(B)
x.funcB()

x = A(C)
x.funcC()

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List