Calc function in classes and instances in main