Tuesday, October 25, 2011

Overloading

Can not believe it for an overloading in programming OOP (Object Oriented Programming), It was very in need in a class called repeatedly with different parameters in the same class and the same method, it does not mean overriding. As in VB.Net:


different from the python, in python there are several constructors, but it's rather difficult when compared to Java or Dot Net. like the __init__ constructor, the constructor can not be overloading the constructor of the same name before, just be overloading the operator or by the same constructor, but do not know in their use?
misalnya seperti :

class com:
    def __init__(self):
        print "original constructor"
    def __init__(self, val1):
        print "second overloading"
    def __init__(self, val1, val2):
        print "thrid overload"
this is wrong. because in python does not apply to any such provisions.
What about python?


No comments:

Post a Comment