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

C++ Equivalent to VB Shared Constructors

The C++ equivalent to a VB shared constructor uses a private nested class.

VB C++
Class Foo
    Public Shared field As Integer

    Shared Sub New()
        field = 1
    End Sub
End Class
class Foo
    static int field;

    class StaticConstructor
            field = 1;

    static Foo::StaticConstructor staticConstructor;

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

Additional resource: VB.NET and C++ Equivalents

Copyright © 1997 – 2018 Tangible Software Solutions Inc.