• Saves Valuable Time
  • Trusted Accuracy for 12 Years
  • 15-Day Money-Back Guarantee

C++ Equivalent to VB Operator Overloading

VB operator overloading is similar to C++ operator overloading, except that VB operator overloads are static methods while C++ operator overloads are instance methods. During conversion by VB to C++ Converter, the first parameter is removed and corresponds to 'this'.

VB C++
Public Class SomeType
    Private IntValue As Integer

    Public Shared Operator +(ByVal X As SomeType, ByVal Y As SomeType) As Integer
        Return X.IntValue + Y.IntValue
    End Operator
End Class
class SomeType
{
private:
    int IntValue = 0;

public:
    int operator + (const SomeType &Y)
    {
        return this->IntValue + Y.IntValue;
    }
};


Use VB to C++ Converter to convert from VB to C++.     


Copyright © 1997 – 2017 Tangible Software Solutions Inc.