Object-oriented simple explanation

inherit

{1,2,3}

{1,2,3,4,5}

class foo(object):
    def __init__(self, arg)
        self.a = 100;
    def doAction(self, arg1, arg2)
        self.b = arg1
        self.c = arg2


class child(foo):
    def __init__(self, arg)
        super(self,child).__init__(self, arg)
        self.doAciton(self,1,2)
        pass


_a = child(1);
print _a.a

overwrite

polymorphism

a->run,
b->run,
c->run,

for(int i = 0;  i < size; i++)
    v[i]->run();

package

public:
    int a;
private:
    int b;

abstract

class foo
{
    public:
        interface void a() = 0;

    public run()
    {
        1
        2
        3

        sgfgfsdg = a();
        1
        2
        3
    }

}



class method
{
    public void foo(interger a, interger b, interger...mmmm)
    {

    }
}


method a  = new method();
a.foo(1,2,3);
a.foo(1,2,3,4);
a.foo(1,2,3,4,5);

def foo(a, *b)
    pass

foo(1, 1,2,3);

def foo2



foo *b  = new foo();
b->run();


class child : public foo
{

}

Class properties & instance properties

b = new foo(1,2);
c = new foo(3,4)

class foo()
    a = 0;
    def __init__(self, x, y)
        self.c = x
        seld.d = y

        self.level = xxxx;
        self.curExp = aaa;
        #self.isUsed = true;
        print x,y

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326050276&siteId=291194637