The C++ Workshop by Dale Green Kurt Guntheroth and Shaun Ross Mitchell
Author:Dale Green
, Kurt Guntheroth
, and Shaun Ross Mitchell
Language: eng
Format: epub, mobi
Publisher: Packt Publishing Pvt. Ltd.
Published: 2020-12-24T00:00:00+00:00
The next step is to begin entering the body of main(). First, declare an instance of numeric_list called l. This function-local variable will be destroyed when main() returns: numeric_list l;
Create a for loop to add five items to the list, and then print out the list: for (int i = 1; i < 6; ++i)
{
l.add(i);
}
l.print();
Declare a numeric_item pointer called p, and assign to p the value returned by l.find(4). The value in p is an unowned pointer. We already know find() will discover an item with this value because we added it moments ago. Output a message if the returned pointer is not nullptr, just to be sure: numeric_item* p = l.find(4);
if (p != nullptr)
cout << "found numeric_item 4" << endl;
That's it. When main() returns, p is still pointing to an item in l. p isn't deleted, but that's fine because p is an unowned pointer.
As main() returns, l's destructor is called. Since l has an owned pointer, l's destructor must delete anything it points to, which is the entire list.
Download
The C++ Workshop by Dale Green Kurt Guntheroth and Shaun Ross Mitchell.mobi
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9931)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9806)
The Mikado Method by Ola Ellnestam Daniel Brolund(9798)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8317)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7799)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7777)
Grails in Action by Glen Smith Peter Ledbrook(7711)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7573)
Windows APT Warfare by Sheng-Hao Ma(7024)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6754)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6636)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6431)
Kotlin in Action by Dmitry Jemerov(5080)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4329)
Solidity Programming Essentials by Ritesh Modi(4099)
Functional Programming in JavaScript by Mantyla Dan(4051)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3897)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3843)
The Ultimate iOS Interview Playbook by Avi Tsadok(3812)
