Introduction to C++

Published

2023-08-05

C++ is a great language for learning data structures and algorithms. C++ is strongly and statically typed, so we must be explicit in our code when we declare variables, structures, classes, and functions. This forces our attention on certain details of implementation that reinforce concepts we’re learning in this class.

Python isn’t quite as well suited to this task since it has too many conveniences that can hide implementation details.

Java isn’t quite as well suited to this task since it requires more code scaffolding and isn’t as concise as C++. Also, we’ll use some features of C++ that aren’t present in Java (e.g., operator overloading).

One thing you’ll notice about C++ is that, unlike Java, C++ does not have garbage collection—so be careful to destroy objects and deallocate memory where needed.

In the end, we think you’ll find C++ provides a rewarding programming paradigm that is just right for this course. In fact, we think programming in C++ is fun, and we hope you’ll feel the same when the semester is over!

In these videos we demonstrate numerous C++ features by implementing a C++ class which represents data about computer science lecturers. This is intended to provide an overview, so don’t worry if there are parts that aren’t quite clear. We’ll go through many of these features—elements of the standard library, output manipulation, file input, overloaded operators, pointers and addresses, and C++ templates in subsequent videos. We also compare some features with Java, giving code examples.

Part 1 (22:18) covers project organization, class definition, constructor, and accessors, and provides a comparison with classes in Java.

Part 2 (41:12) covers output manipulation, overloading operators, reading data from a file, and writing a test program.

Part 1

Part 2

Resources

More on C++

C++ Logo

If you’re interested, here are some resources on the history of C++, the language standard we use for this class (C++ 17), and other goodies.

You will not be assessed on any material listed immediately above.

Original author: Clayton Cafiero < [given name] DOT [surname] AT uvm DOT edu >

No generative AI was used in producing this material. This was written the old-fashioned way.

All materials copyright © 2020–2023, The University of Vermont. All rights reserved.