In below scenario for class xyz I am facing some issue when I call method2 and keep breakpoint to called place at method1 its jumping to the middle method1 having the extra std::optional argument
class xyz {
public:
virtual int method(int, int) = 0;
virtual int method1(int32, int32, struct abc) = 0;
virtual int method1(int32, int32, struct abc, std::optional<int32> l) = 0;
virtual int method2(int32) = 0;
virtual int method3(int, int) = 0;
virtual int method4(int, int) = 0;
};
class x : public xyz {
int method(int, int);
int method1(int32, int32, struct abc);
int method1(int32, int32, struct abc, std::optional<int32> l);
int method2(int32);
int method3(int, int);
int method4(int, int);
};
obj1->method2(10); // obj1 is pointer object of class x which implements method of interface class xyz
Initially I did not able to identify the exact cause but when I moved this method1 both of the pure virtual functions up or down somewhere after method3 or method4 then calling method3 or 4 calls to middle method1 having the extra std::optional argument (same behavior seen for method2 as explained above), by seeing this behavior I am not sure about the inside concept why such behavior, please explain me whats wrong with the code and how do I avoid?
Is it something because of std::optional variable or something else? also I did not find any examples or query with similar behavior.
Updated my query for better understanding, cant provide more info/code as code is proprietary and tried to shorten problem statement out of it.
For debugging I am using Visual Studio and kept break point at those called functions.