NobleBlocks

Research index

Mastering Classes and Objects

13 Feb 2021

NobleIDark:/48914/w1/20260521/EF051902DOI10.1002/9781119695547.ch9

Paywalled

The full text is at the publisher

You can read the abstract here, or open it at the publisher.

Read at the publisher

Abstract

This chapter explains how to manipulate and exploit some of the most powerful aspects of the C++ language to write safe, effective, and useful classes. It begins with the concept of friends in the C++ world. Many of the concepts in this chapter arise in advanced C++ programming, especially in the C++ Standard Library. The Standard Library uses operator overloading extensively. A feature similar to method overloading in C++ is default arguments. C++ allows classes to declare that other classes, member functions of other classes, or non-member functions are friends, and can access protected and private data members and methods. The compiler-generated methods recursively call the copy constructor or assignment operator on object data members. Dynamically allocated memory in objects provides several challenges, including freeing the memory, handling object copying, and handling object assignment.

Discussion

Topics

More

Suggest a correction or report