What Is the Difference Between C++ & Visual Basic?

By Simone Spada

Updated September 28, 2017

Thanks to its object-oriented redesign and subsequent evolution, Visual Basic now shares much in common with C++, but the two languages, which were created for different purposes, were never intended to be interchangeable. There are several important differences between them.

One Platform vs. Multiple

Visual Basic must be compiled and run on a version of the Microsoft Windows operating system. C++ compilers exist on almost every modern operating system.

Readable vs. Cryptic

Visual Basic syntax more closely resembles a natural language, most of it decipherable by even a novice. The syntax of C++, while not as spare as its progenitor C, is, arguably, even more cryptic.

Pointers vs. Managed Code

Just a notch above machine code, C++ has constructs called "pointers" which allow for direct memory access and allocation. This means that code can be fast and efficient but also rife with debilitating bugs and security risks. Visual Basic, on the other hand, runs within the .NET Framework. This environment manages memory allocation and controls access to system resources, thus greatly reducing bugs, memory leaks and security risks. Though fast and efficient, Visual Basic can never be as fast as non-managed C++.

Multiple Inheritance vs. Interfaces

C++ allows a class to derive from multiple base classes; Visual Basic does not, but instead uses Java-like interfaces to get most of the benefits of multiple inheritance with none of the drawbacks.

Delegates and Events

Visual Basic includes the Event statement and Delegate type to better work with the event-based architecture of graphical user interfaces and web forms. C++ has no such tools.

×