How to correctly overload a variable in class inheritance with the same variables
<p>I need to override or overload a variable in a class inheritance. Here is what I am trying to achieve:</p>

<pre><code>class MainClass:
    def __init__(self, a, b, c, d):
        type(a) = str

class MyClass(MainClass):
   def __init__(self, a, b, c, d):
       type(a) = object of one of my classes.
</code></pre>

<p>How do I achieve this in Python 3? I have looked into inheritance but either this type of situation is not discussed or I don't get it.</p>

<p>What it seems like you're trying to do is make each class able to access the other. However this is not how class inheritance works. Try using this for the classes to access each other. </p>

<pre><code>class MainClass:
    def __init__(self, a, b, c): # main class with variables, a, b and c.
        self.a = a
        self.b = b
        self.c = c

    def printall(self): # this will be so we can see what happens
        print(self.a)
        print(self.b)
        print(self.c)

class MyClass:
    def __init__(self, class_inst, a): # another class of a class and a variable
        self.a = a
        self.class_inst = class_inst

    def override(self): # this will override(or overload) the other class variable.
        self.class_inst.a = self.a
</code></pre>

<p>Write some testing code for it like this. </p>

<pre><code>class_inst_one = MainClass("Hello","World","!")
class_inst_two = MyClass(class_inst_one, "Replacement")
class_inst_one.printall()
class_inst_two.override()
class_inst_one.printall()
</code></pre>

<p>Now you should get an output like this.</p>

<pre><code>Hello
World
!
Replacement
World
!
</code></pre>

python python-3.x inheritance