Instructor-led training
C++/CLI Essentials Training in Sun Prairie, Wisconsin
This two-day course is designed for the experienced C++ programmer to help you quickly come up to speed on the C++/CLI language.
What you'll learn
Private Training for Teams
This course is offered as private, instructor-led training for organizations, onsite in Sun Prairie, Wisconsin or live online. Dates, delivery format, and course content are arranged around your team's requirements.
This course is not currently scheduled as a public class for individual enrollment.
Request Group TrainingPrerequisites
Course Outline
.NET: What You Need to Know
Getting Started
.NET: What Is Really Happening
.NET Programming in a Nutshell
Viewing the Assembly
Viewing Intermediate Language
Understanding .NET
Visual Studio 2005
Visual C++ 2005 Express Edition
Creating a Console Application
Solution Explorer
Adding a C++ File
Using the Visual Studio Text Editor
IntelliSense
Build and Run the Project
Pausing the Output
Visual C++ 2005 and GUI Programs
.NET Documentation
C++/CLI Fundamentals
Hello, World
Compiling, Running (Command Line)
Program Structure
Namespaces
Variables
Input in C++/CLI
Classes in C++/CLI
InputWrapper Class
Input Wrapper Implementation
Control Structures
C++/CLI Operators
Types in C++/CLI
Simple Types
Types in System Namespace
Implicit Conversions
Explicit Conversions
Cast Notation
value struct
Uninitialized Variables
Enumeration Types
Reference Types
Class Types
Object
String
Copying Strings
StringBuilder Class
Classes and Value Classes
RHotel Ref Class
Copy Constructors in C++/CLI
VHotel Value Class
RaisePrice Methods
Value Class versus Ref Class
Arrays
One-Dimensional Arrays
System.Array
Jagged Arrays
Rectangular Arrays
for each for Arrays
Boxing and Unboxing
Output in C++/CLI
Formatting
Exceptions
System::Exception
Object-Oriented Programming in C++/CLI
Classic C++ Object Model
Object Lifetime in Classic Model
Object Lifetime in .NET Model
Object Lifetime in C++/CLI
Stack Allocation
C++/CLI Object-Oriented Features
Encapsulation and Properties
Using a Property
Indexed Properties
Using an Indexed Property
Trivial Properties
Account Class
Namespace
Constructors
Static Members
Inheritance in C++/CLI
New Version of Base Class
Features of the New Base Class
Derived Class
Overriding a Virtual Function
Fragile Base Class Problem
Abstract Ref Classes
Derived Classes
C++/CLI and the .NET Framework
Components and OO in C++/CLI
Interfaces in C++/CLI
Interface Inheritance
Programming with Interfaces
Implementing Interfaces
Using an Interface
Dynamic Interfaces
Account Interfaces
BasicAccount Class
Account Class
Interfaces in C++/CLI and COM
Resolving Ambiguity
Explicit Interface Implementation
System::Object
Collections
ArrayList
ArrayList Methods
Adding and Removing String
IEnumerable and IEnumerator
Using Enumerators
Collections of User-Defined Objects
Account Class
AccountList Class
Copy Semantics in C++/CLI
Deep Copy and Icloneable
Writing Generic Code
Using a Class of Object
Generic Types
Generic Syntax in C++/CLI
Generic Client Code
System::Collections::Generic
Delegates and Events
Overview of Delegates and Events
Callbacks and Delegates
Usage of Delegates
Declaring a Delegate
Defining a Method
Creating a Delegate Object
Calling a Delegate
Random Number Generation
A Random Array
Combining Delegate Objects
Account.h
DelegateAccount.cpp
Events
Events in C++/CLI and .NET
Client Side Event Code
Introduction to Windows Forms
Creating a Windows Forms App
Windows Forms Event Handling
Add Events for a Control
Events Documentation
Closing a Form
ListBox Control
What makes C++/CLI hard to master
For an experienced C++ developer the syntax is familiar. The hard part is that C++/CLI runs on two object models at once, and habits from classic C++ do not always carry over. The syllabus is ordered to address this.
- Runtime first. The course starts with what .NET is doing: assemblies, intermediate language, and how to view both. This explains behavior that later topics build on.
- Two kinds of types. Simple types, value struct, enumerations and reference types are covered, followed by a side-by-side comparison of a value class and a ref class (the RHotel and VHotel examples). Choosing between them, and understanding the copy-constructor and copy-semantics consequences, is a common source of subtle bugs. Boxing and unboxing add a further trap.
- Object lifetime. The course contrasts lifetime in the classic C++ model, the .NET model and C++/CLI, including stack allocation. Developers who assume deterministic destruction everywhere, or assume the opposite, will be surprised.
- Language features that differ from C++. Properties, indexed properties, interfaces (including how they relate to COM and how to resolve ambiguity with explicit implementation), and the fragile base class problem each need their own mental model.
- Generics versus object collections. The course first uses
ArrayListand a class ofObject, then shows generic types andSystem::Collections::Generic. This makes the type-safety trade-off concrete. Generics are not C++ templates, and treating them as such is a frequent misconception. - Delegates and events. Delegate declaration, combining delegate objects and event handling lead into a short Windows Forms introduction with a ListBox control.
Who it suits and what to take around it
The stated prerequisite is an experienced application developer or architect with good working knowledge of C++ and object-oriented programming. The course is introductory to C++/CLI, not to C++, and it moves quickly over two days. It suits teams that maintain or extend existing C++/CLI code, or that need C++ developers working with .NET types, collections, delegates and events.
If your C++ is rusty or mostly C-style, C++ Programming is a more suitable foundation, since this course assumes you already work comfortably with classes, inheritance and virtual functions. For a broader treatment of the same language across more days, .NET Framework Using C++/CLI is the natural follow-on. Browse the C++ Programming courses and learning guide for related options.
Illustrative scenarios
The scenarios below are illustrations of how the course material can be applied. They are not descriptions of specific organizations or of the course's lab exercises.
- Domain model with interfaces. A team might model accounts with a base class, a derived class and several interfaces. It would use explicit interface implementation to resolve ambiguity and
ICloneablefor deep copies. The syllabus's Account, BasicAccount and interface topics map directly to this. - Replacing untyped collections. For example, a developer maintaining code that stores user-defined objects in an
ArrayListcould move it to generic collections to remove casts and gain type checking. This draws on the collections, enumerator and generics sections. - Callback-driven desktop tool. A small utility might use delegates for callbacks and events for notifications, with a Windows Forms ListBox displaying results. This combines the delegate, event and Windows Forms topics.
AI coding assistants and C++/CLI
AI coding assistants can explain unfamiliar C++/CLI code, draft boilerplate such as property and interface declarations, and suggest unit tests. C++/CLI is a niche dialect, so their weaknesses show up in predictable places.
- Wrong dialect. Suggestions often drift into C# syntax or standard C++ idioms that do not fit managed ref classes, value classes or .NET collections.
- Value versus reference semantics. Generated code may mishandle copying, boxing or object lifetime, and the result can compile yet behave differently than intended.
- Dated or mismatched patterns. An assistant may default to untyped collections where generics fit better, or wire up delegates and events incorrectly.
To verify, compile and run everything, and inspect the generated assembly and intermediate language, which the course teaches you to view. Write tests for copy and equality behavior, and exercise event handlers deliberately. Treat assistant output as a draft to review against what you learn here.
Frequently asked questions
What level is this course?
It is introductory to C++/CLI but written for experienced C++ developers. It runs two days and moves quickly through the language, so it is not a first course in C++.
What should I know before attending?
Good working knowledge of C++ and object-oriented programming, as an experienced application developer or architect. Developers who need a stronger C++ foundation can start with the C++ Programming course.
What does the course cover?
The .NET runtime basics, the Visual Studio workflow, C++/CLI fundamentals and types, ref and value classes, arrays, exceptions, object lifetime, properties, inheritance, interfaces, collections, generics, delegates and events, and an introduction to Windows Forms.
Can it be delivered privately, onsite or online?
Yes. HSG delivers private training for organizations either onsite at the client's location or live online.
Can the content be customized?
Private training can be tailored, including to the technology versions your organization uses. To discuss emphasis or other versions, request a training proposal.Training locations
C++/CLI Essentials training across the U.S. and beyond.
We provide private C++/CLI Essentials training for organizations, onsite at your location or live online, throughout the United States and internationally.
View all C++/CLI Essentials training locations
Train your team with HSG
Private, instructor-led training customized for your organization.
- Onsite or live online delivery
- Customized curriculum
- For a single employee or an entire team
- Flexible scheduling
- Experienced instructors
Questions? Call us at 303.377.6176
or email info@hartmannsoftware.com
Ready to train your team?
Let's customize this training for your organization.
Tell us about your employees, your goals, and your preferred schedule. We'll prepare a training proposal covering scope, delivery format, and pricing.