• Saves Valuable Time
  • Trusted Accuracy since 2004
  • 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
    int IntValue = 0;

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

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

Additional resource: VB.NET and C++ Equivalents

Copyright © 2004 – 2021 Tangible Software Solutions, Inc.