Jan-11-2023, 05:52 AM
(Jan-10-2023, 08:55 PM)sabuzaki Wrote: This is what I have currently. The class copies value from other class.You are confusing code that goes in the body of the class with code that must be executed by instances of the class (in the methods of the class). If you write
var = Bridge.var
in the body of class Port, this code will be executed only once, it will not be executed by every instance of Port.Learn the difference between classes and instances. Variables defined in the body of the classes are class variables. They are shared by all the instances.