4 Functions: Many Are Called
From the earliest days of computers, one of the major goals of programmers has been to avoid having to write the same group of statements over and over. This is the search for reusability, and it is a major reason why object-oriented programming (OOP) was developed. But the most basic technique for writing reusable code is the use of functions—often known as procedures or subroutines in other languages.
A function is a group of related statements that accomplish a specific task. Once you define a function you can execute it whenever you need to. Beyond that functions provide a way to divide a complex program into smaller, more doable tasks. Without this division of labor, serious programming would be just about impossible ...
Get C++ Without Fear: A Beginner’s Guide That Makes You Feel Smart 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.