2A. No Ducks Allowed – Types and Deduction

Learning Objectives

By the end of this chapter, you will be able to:

  • Implement your own classes that behave like built-in types
  • Implement classes that control which functions the compiler creates (Rule of Zero/Rule of Five)
  • Develop functions using auto variables, like you always have
  • Implement classes and functions by making use of strong typing to write safer code

This chapter will give you a good grounding in the C++ type system and allow you to write your own types that work in that system.

Introduction

C++ is a strongly typed, statically typed language. The compiler uses type information related to the variables that are used and the context in which they are used to detect and prevent ...

Get Advanced C++ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.