Start free trial
Trending New Genres Authors
EnglishEnglish
EspañolSpanish
简体中文Chinese
繁體中文Chinese (Traditional)
FrançaisFrench
DeutschGerman
日本語Japanese
PortuguêsPortuguese
ItalianoItalian
한국어Korean
РусскийRussian
NederlandsDutch
العربيةArabic
PolskiPolish
हिन्दीHindi
Tiếng ViệtVietnamese
SvenskaSwedish
ΕλληνικάGreek
TürkçeTurkish
ไทยThai
ČeštinaCzech
RomânăRomanian
MagyarHungarian
УкраїнськаUkrainian
IndonesiaIndonesian
DanskDanish
SuomiFinnish
БългарскиBulgarian
עבריתHebrew
NorskNorwegian
HrvatskiCroatian
CatalàCatalan
SlovenčinaSlovak
LietuviųLithuanian
SlovenščinaSlovenian
СрпскиSerbian
EestiEstonian
LatviešuLatvian
فارسیPersian
മലയാളംMalayalam
தமிழ்Tamil
اردوUrdu
Searching...
SoBrief
Object-oriented Programming with C++

Object-oriented Programming with C++

Build C++ programs that can adapt to changing needs without turning every revision into a rewrite.
by E. Balagurusamy 1994 336 pages
3.98
278 ratings
Listen
Immersive
V2.3
Amazon Kindle Audible
Try Full Access for 3 Days
Unlock listening & more!
Continue

Key Takeaways

Keep data and the operations that protect it inside one object.

The problem with exposed data. In procedure-oriented programs, functions do the work while data may be shared widely. A change to a shared data structure can force changes across many functions, inviting bugs. Object-oriented programming instead organizes a system around objects that hold data and the operations that use it. Objects communicate through requests, without needing to know one another’s internal implementation.

The failure figures are stark. The book cites a study of US defence software projects from the 1970s: about half were never delivered, a third of delivered systems were never used, and only 2% were used as delivered without changes. The author presents changing requirements and weak maintainability as central problems that object-oriented design aims to address.

Analysis

What's striking is that the proposed remedy is also a way to limit the damage of change. When data and its permitted operations stay together, a modification can be contained rather than rippling through unrelated code. This resembles compartmentalization in engineering: boundaries make a system easier to inspect and repair. Encapsulation is not a guarantee of quality, however. A badly designed object can hide confusing rules just as effectively as it hides useful details.

Design classes around stable promises, not exposed implementation details.

A class defines a usable type. It groups data members with member functions, then objects are created as individual instances of that class. A class can hide internal data and expose selected public operations. This separation supports abstraction, which means presenting essential features while leaving irrelevant implementation details out of view. For example, a customer object can request an account balance through an account operation without directly inspecting the account’s stored data.

Keep the interface distinct. The book describes a client-server arrangement: a class offers services through its public interface, and a client program uses those services. A common organization puts class declarations in a header, member-function definitions in a source file, and the main program in another file. That division lets users rely on the class’s interface without depending on how its services are implemented.

Analysis

A public interface is a promise about how other parts of a program may rely on a class. Keeping that promise stable reduces the amount of knowledge each client must carry, much as a well-defined boundary helps teams divide work. Yet hiding data alone does not create a good abstraction. The exposed operations must reflect the real responsibilities of the object, or the class merely relocates complexity behind a new door.

Make object lifetime explicit through construction, ownership, and cleanup.

Construct objects ready to use. A constructor runs when an object is created and can initialize its data members. C++ constructors may accept parameters, have defaults, or be overloaded for different initialization needs. A copy constructor creates a new object from another object of the same class. These mechanisms make initialization part of creating an object, rather than a separate step that every caller must remember.

Release what was reserved. A destructor runs when an object’s lifetime ends and is especially important when a constructor uses `new` to allocate memory. The matching cleanup uses `delete`. Ordinary local objects are destroyed as their scope ends, in reverse order of creation; dynamically allocated objects require explicit cleanup. The distinction matters: automatic object destruction does not automatically release every resource obtained manually.

Analysis

Construction and destruction turn resource management into a question of ownership and time: who creates a resource, and who is responsible for releasing it? That is a powerful way to reason about memory, because many failures arise from unclear responsibility rather than difficult algorithms. The book’s examples also reveal a limit of manual allocation: every path through a program must preserve the creation-cleanup pairing. A lifecycle convention helps, but it still depends on disciplined implementation.

Reuse classes through inheritance only when the relationship is genuinely is-a.

Derive to extend. Inheritance creates a new class from an existing base class, allowing the derived class to reuse accessible members and add specialized behavior. The book distinguishes single, multilevel, multiple, hierarchical, and hybrid inheritance. Access rules matter: public inheritance preserves public access to inherited public members, while private inheritance makes them private in the derived class. Protected members can be used by derived-class functions while remaining hidden from ordinary outside access.

Watch for duplicated ancestors. In a diamond-shaped hierarchy, a class can inherit the same ancestor through two paths, producing duplicate base-class members. Declaring the shared ancestor as a virtual base class ensures the final derived class receives one shared copy. Inheritance is useful for extending a close fit, but the relationship should represent a true specialization, not merely a convenient way to borrow code.

Analysis

Inheritance can encode a meaningful taxonomy, so a specialized object can be treated as a more general kind of object. That can simplify reuse and let shared behavior live in one place. The design becomes brittle when the hierarchy describes code convenience rather than the domain. The diamond example makes the cost visible: a choice that looks local can affect object identity and access throughout the family of classes.

Use virtual dispatch when one interface must serve different object types.

One request, different behavior. Polymorphism means that objects of different classes can respond to the same operation in different ways. Function and operator overloading resolve choices at compile time using argument types and counts. Runtime polymorphism uses virtual functions: when a base-class pointer refers to a derived object, the program selects the matching function according to the actual object at run time.

A media example makes it concrete. The book defines a general media class and specialized book and tape classes. Each supplies its own display operation, showing book pages or tape playing time. A pure virtual function has no base-class implementation and requires derived classes to provide one; a class with such a function is abstract and cannot be instantiated. This allows a general interface without pretending every object behaves identically.

Analysis

Virtual dispatch separates the question of what an operation is called from the question of what a particular object does. That is especially useful in extensible systems: a caller can use a shared interface without branching on every concrete type. The design still depends on meaningful behavioral contracts. If derived classes respond in incompatible ways, a common function name creates superficial uniformity rather than genuine substitutability.

Give functions checked signatures and operators familiar meanings.

Let signatures catch mistakes. A function prototype tells the compiler the function’s name, parameter types, and return type. C++ checks calls against that declaration, while references allow a function to work with an original variable rather than a copy. Inline functions can reduce call overhead for small operations, and default arguments let callers omit parameters that commonly take the same value.

Overload with restraint. C++ can give an existing operator an additional meaning for class objects, such as adding complex numbers or vectors. An overloaded binary operator implemented as a member function receives the right-hand operand explicitly; a friend function receives both operands explicitly. The operator’s original precedence and syntax do not change, and some operators cannot be overloaded. A useful overload should make an expression clearer, not disguise an unexpected action.

Analysis

These features make a class feel like a coherent type rather than a bundle of special-case procedures. A checked function signature moves some errors from program execution to compilation, while a familiar operator can make domain operations easier to read. The danger is semantic camouflage: concise notation can conceal costly or surprising work. The strongest design choice is not maximal convenience, but an interface whose meaning remains obvious to someone who did not write the class.

Use templates and STL to write algorithms once across data types.

Parameterize reusable code. A template defines a class or function with a type parameter, which the compiler replaces with a chosen type when the code is used. A vector template, for example, can support integer and floating-point elements without requiring separate hand-written classes. Templates may also accept several parameters, including values such as an array size.

Separate storage from processing. The Standard Template Library, or STL, combines containers, algorithms, and iterators. Containers hold data: vectors support fast random access, lists support efficient insertion and deletion, and maps associate keys with values. Algorithms perform tasks such as sorting or searching, while iterators provide a common way to traverse container elements. Choosing a container by how the program uses its data is often more important than choosing one by habit.

Analysis

Templates and the STL make reuse practical by separating an algorithm’s logic from the type of data it handles and the structure that stores it. Iterators are the connective tissue: they let a sorting routine work across compatible containers without needing to know each container’s internal layout. This is a powerful form of abstraction, but generic code is not automatically appropriate for every type. The operations an algorithm assumes must actually make sense for the elements supplied.

Treat input, files, and failures as part of program design.

Streams unify communication. C++ treats input and output as streams, sequences of bytes moving between a program and a device or file. `cin` and `cout` handle console input and output; file streams read from or write to named files. File modes determine whether a file is opened for reading, writing, appending, or other purposes. File pointers support sequential processing as well as moving to a chosen location for random access.

Plan for abnormal conditions. Exceptions represent unusual run-time conditions, such as division by zero or unavailable memory. A `try` block contains code that may throw an exception, and a matching `catch` block handles it. Multiple handlers can address different exception types, while a catch-all handles types not listed individually. The standard `string` class also replaces many manual character-array operations with built-in string manipulation.

Analysis

Input and failure handling are not decorative layers added after the algorithm. They define what the program can safely assume about its environment and how it responds when those assumptions fail. Streams give console and file operations a shared model; exceptions give abnormal paths an explicit structure. The book’s mechanisms still require careful checks, especially around file state and memory. A handler that catches an error but leaves the program’s data inconsistent has only hidden the failure.

Build software iteratively, testing user needs before polishing implementation.

Move beyond the waterfall. The conventional development sequence runs from problem definition through analysis, design, coding, testing, and maintenance. The book contrasts this waterfall approach with a fountain model for object-oriented development, where stages overlap and teams revisit earlier decisions as they learn more. Object-oriented analysis identifies objects, their attributes, services, and collaborations; design organizes classes, dependencies, and member functions.

Prototype to clarify the problem. A prototype is a working, reduced version of a proposed system, built to test requirements and design choices with users. It can reveal missing needs before the complete system makes changes expensive. The book’s project examples, a typing tutor and a telephone billing system, illustrate how classes, files, and user-facing operations come together. Prototypes are chiefly learning tools; the text cautions that they may be discarded rather than turned directly into finished products.

Analysis

The iterative model recognizes that requirements are discovered through interaction, not merely collected at the start. A prototype makes an abstract specification concrete enough for users and developers to challenge. That can expose mismatches before they become embedded in architecture. Iteration is not a license for aimless revision, however. Useful cycles need a clear question, a testable version, and a decision about what the result means for the design.

Analysis

This is both a C++ course and an argument about how software should be organized. Its central move is from procedures acting on widely shared data toward objects that combine state with permitted operations. The rest of the book makes that move practical: classes establish boundaries, constructors and destructors manage lifetimes, inheritance extends existing types, and virtual functions let callers rely on shared interfaces while behavior varies by object.

The teaching sequence is cumulative. It begins with familiar C syntax, introduces classes and objects, then adds mechanisms that make user-defined types more capable: operator overloading, inheritance, pointers, templates, exceptions, streams, and the Standard Template Library. The final software-development chapter broadens the lens from code to requirements, design, testing, and prototyping. This structure helps readers connect a language feature to a larger engineering purpose rather than treating syntax as an isolated trick.

The most durable lesson is not that object-oriented programming always wins. It is that complexity needs explicit structure. Encapsulation can limit the consequences of change, inheritance can capture real specialization, and templates can reduce duplicated implementations. Each feature also creates design obligations. Poorly chosen class boundaries hide confusion; inappropriate inheritance creates fragile hierarchies; operator overloading can make code misleading; manual memory management depends on correct cleanup.

The book’s fifth edition follows the ANSI/ISO C++ standard of its period, so readers should distinguish enduring concepts from historical tooling and language idioms. Its discussion of Turbo C++, older headers, and particular file modes reflects a different programming environment from current C++. The conceptual foundations remain useful, but the examples are best read as lessons in interfaces, state, reuse, and control of failure, not as a complete modern C++ reference. In that sense, the text succeeds most when it teaches judgment about where a feature belongs, not merely how to spell it.

Summary in 30 Seconds
Object-oriented programs group state with the operations allowed to use it, limiting how changes spread. Classes expose a usable interface while concealing internal details. Constructors initialize objects, and destructors help release resources; manually allocated memory still requires explicit cleanup. Inheritance suits genuine specialization, while virtual functions let different types respond through a common interface. Templates and the STL enable reusable algorithms and data structures. Prototypes test requirements early. A cited study found only 2% of defense software projects were used as delivered.
Contains spoilers

Last updated:

Report Issue

Review Summary

3.98 out of 5
Average of 278 ratings from Goodreads and Amazon.

Object-oriented Programming with C++ receives mixed reviews. While some readers praise it as a great resource for learning OOP concepts in C++, others criticize it for containing errors and mistakes in the programming examples. The book is recommended by professors for computer courses and appreciated for its straightforward explanations. However, some readers suggest seeking alternative sources to learn C++ basics. Despite the criticisms, many reviewers rate it highly, with an overall rating of 3.96 out of 5 based on 271 reviews. Some readers find it useful for definitions and theoretical explanations.

Your rating:
4.35
97 ratings
Want to read the full book?

Glossary

Data Abstraction

Essential features, not details

Data abstraction represents the essential properties and operations of an entity while leaving background implementation details out of view. In the book, a class acts as an abstract data type by describing relevant attributes and the functions that operate on them. Users work through the class’s interface rather than depending on its internal representation.

Encapsulation

Bundled data and operations

Encapsulation places data and the functions that operate on that data within one class. The class can restrict direct access to its internal members and expose selected public functions instead. This supports data hiding: external code uses the available interface rather than changing internal values arbitrarily.

Inheritance

Deriving and extending classes

Inheritance creates a derived class from one or more existing base classes. The derived class can reuse accessible members and add or redefine features. The book treats inheritance as a way to extend and reuse tested classes, while access modes determine whether inherited public and protected members remain public, become protected, or become private.

Polymorphism

One interface, varied behavior

Polymorphism allows the same operation or function name to have different behavior depending on its context or the object involved. Function and operator overloading provide compile-time forms, selected from argument types and counts. Virtual functions provide a run-time form in which the actual object type determines which implementation is called.

Dynamic Binding

Run-time function selection

Dynamic binding, also called late binding, connects a function call to its implementation during program execution rather than at compilation. In the book’s C++ examples, a virtual function called through a base-class pointer is selected according to the derived object the pointer actually references.

Virtual Function

Run-time polymorphic operation

A virtual function is a class member function declared with the virtual keyword in a base class. When called through a base-class pointer, the program can choose a matching derived-class implementation based on the object’s actual type. A pure virtual function has no base-class implementation and makes its class abstract.

Abstract Class

Base class without instances

An abstract class is a class intended to provide a common interface or shared features for derived classes, rather than to create objects directly. In the book’s account, a class with at least one pure virtual function is abstract. Derived classes supply implementations for those operations if they are to be instantiated.

Template

Parameterized class or function

A template defines a class or function using one or more parameters, commonly type parameters. When the program uses the template with specific types or values, the compiler creates the corresponding concrete class or function. Templates let similar operations, such as vector handling or swapping, be implemented once for multiple data types.

Standard Template Library

Reusable generic components

The Standard Template Library, or STL, is a collection of generic C++ components for storing and processing data. Its central parts are containers, algorithms, and iterators. Containers hold elements, algorithms perform operations such as searching or sorting, and iterators connect algorithms to container elements.

Iterator

Container traversal object

An iterator is an object, often used like a pointer, that refers to an element in a container and supports movement through its contents. Iterators allow algorithms to operate on container elements without relying on each container’s internal representation. Different iterator categories support different abilities, from forward movement to random access.

Exception Handling

Structured run-time error response

Exception handling is a C++ mechanism for detecting and responding to unusual run-time conditions. Code that may encounter an exception is placed in a try block, an exception is raised with throw, and a matching catch block handles it. Multiple handlers can distinguish types, and a catch-all can handle otherwise unmatched exceptions.

Fountain Model

Iterative development process

The fountain model describes object-oriented software development as overlapping and iterative rather than as a strict one-way sequence. Developers can revisit analysis or design as implementation and testing reveal new information. The model reflects the book’s view that object-oriented development evolves through repeated refinement of objects, classes, and their relationships.

About the Author

E. Balagurusamy is an Indian author and educator known for his contributions to computer science education. He has written numerous textbooks on programming languages, including C, C++, and Java. Balagurusamy has served as a professor and held administrative positions at various educational institutions in India. His books are widely used in undergraduate and postgraduate computer science courses across the country. With a career spanning several decades, Balagurusamy has played a significant role in shaping computer science education in India. His writing style is often praised for its clarity and accessibility, making complex programming concepts easier for students to grasp.

Download PDF

To save this Object-oriented Programming with C++ summary for later, download the free PDF. You can print it out, or read offline at your convenience.
Download PDF
File size: 0.34 MB     Pages: 16

Download EPUB

To read this Object-oriented Programming with C++ summary on your e-reader device or app, download the free EPUB. The .epub digital book format is ideal for reading ebooks on phones, tablets, and e-readers.
Download EPUB
File size: 1.40 MB     Pages: 19
Want to read the full book?
Follow
Listen
Home
Swipe
Library
Get App
Try Full Access for 3 Days
Listen, bookmark, and more
Compare Features Free Pro
📖 Read Summaries
Read unlimited summaries. Free users get 3 per month
🎧 Listen to Summaries
Listen to unlimited summaries in 40 languages
—
❤️ Unlimited Bookmarks
Free users are limited to 4
—
📜 Unlimited History
Free users are limited to 4
—
📥 Unlimited Downloads
Free users are limited to 1
—
Risk-Free Timeline
Today: Get Instant Access
Listen to full summaries of 26,000+ books. That's 12,000+ hours of audio!
Day 2: Trial Reminder
We'll send you a notification that your trial is ending soon.
Day 3: Your subscription begins
You'll be charged on Nov 24,
cancel anytime before.
Consume 2.8× More Books
2.8× more books Listening Reading
Our users love us
1M+ readers
Trustpilot Rating
TrustPilot
4.6 Excellent
This site is a total game-changer. I've been flying through book summaries like never before. Highly, highly recommend.
— Dave G
Worth my money and time, and really well made. I've never seen this quality of summaries on other websites. Very helpful!
— Em
Highly recommended!! Fantastic service. Perfect for those that want a little more than a teaser but not all the intricate details of a full audio book.
— Greg M
Save 62%
Yearly
$119.88 $44.99/year/yr
$3.75/mo
Monthly
$9.99/mo
Start a 3-Day Free Trial
3 days free, then $44.99/year. Cancel anytime.
Unlock a world of fiction & nonfiction books
26,000+ books for the price of 2 books
Read any book in 10 minutes
Discover new books like Tinder
Request any book if it's not summarized
Read more books than anyone you know
#1 app for book lovers
Lifelike & immersive summaries
30-day money-back guarantee
Download summaries in EPUBs or PDFs
Cancel anytime in a few clicks

Why one summary?

Scanner
Find a barcode to scan

⭐
⭐
⭐
We have a special gift for you
Open
38% off
DISCOUNT FOR YOU
⭐
⭐
⭐
$79.99
$49.99/year
Only $4.16 per month
Continue
2 taps to start, super easy to cancel
Settings
General
Widget
Loading...