C++ Programming for Linux Systems by Desislav Andreev
Author:Desislav Andreev
Language: eng
Format: mobi, epub
Publisher: Packt Publishing Pvt Ltd
Published: 2023-09-20T00:00:00+00:00
Account& operator+=(unsigned amount) noexcept {
Print(" balance before depositing: ", balance,
owner);
auto temp{balance}; // {1}
std::this_thread::sleep_for(1ms);
balance = temp + amount; // {2}
Print(" balance after depositing: ", balance,
owner);
return *this;
}
Account& operator-=(unsigned amount) noexcept {
Print(" balance before withdrawing: ", balance,
owner);
auto temp{balance}; // {1}
balance = temp - amount; // {2}
Print(" balance after withdrawing: ", balance,
owner);
return *this;
}
Looking into the implementation of the operator functions shows that they first read the current balance of the account, then store it in a local object (marker {1}), and finally, using the value of the local object, they increment or decrement with the specified amount.
As simple as it gets!
The resulting value of the new balance of the account is written back into the balance member of the Account structure (marker {2}).
We also need to define a method that will be responsible for the actual money transfer:
Download
C++ Programming for Linux Systems by Desislav Andreev.epub
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.
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7760)
Filmora Efficient Editing by Alexander Zacharias(5721)
The Infinite Retina by Robert Scoble Irena Cronin(5199)
Learn Wireshark - Fundamentals of Wireshark. by Lisa Bock(3941)
Linux Device Driver Development Cookbook by Rodolfo Giometti(3932)
Edit Like a Pro with iMovie by Regit(3391)
Linux Administration Best Practices by Scott Alan Miller(2857)
Linux Command Line and Shell Scripting Techniques by Vedran Dakic & Jasmin Redzepagic(2834)
MCSA Windows Server 2016 Study Guide: Exam 70-740 by William Panek(2520)
Mastering PowerShell Scripting - Fourth Edition by Chris Dent(2363)
Docker on Windows by Stoneman Elton(2317)
Kali Linux - An Ethical Hacker's Cookbook: End-to-end penetration testing solutions by Sharma Himanshu(2310)
Creative Projects for Rust Programmers by Carlo Milanesi(2212)
Hands-On AWS Penetration Testing with Kali Linux by Karl Gilbert(2107)
Hands-On Linux for Architects by Denis Salamanca(2051)
Programming in C (4th Edition) (Developer's Library) by Stephen G. Kochan(2002)
Computers For Seniors For Dummies by Nancy C. Muir(1995)
The Old New Thing by Raymond Chen(1938)
Linux Kernel Debugging by Kaiwan N Billimoria(1761)
