Upload
situvnn
View
2
Download
0
Embed Size (px)
DESCRIPTION
Review of C++
Citation preview
Encapsulation, Inheritance, Polymorphism and Generics
Construction is a large part of software development.
Depending on the size of the project, construction typically takes 30 to 80 percent of the total time spent on a project.
Anything that takes up that much project time affects the success of the project.
C++ is a general-purpose programming language that:
is a better C
supports data abstraction
supports object-oriented programming
supports generic programming
C++, an object-oriented language founded on C, was developed at Bell Laboratories in the late 1970s.
C and C++ provides classes, polymorphism, exception handling, templates, and it provides more robust type checking than C does.
C++ provides an extensive and powerful standard library.
A class is a collection of data and routines that share a common responsibility.
A key to effective programming is maximizing the portion of a program that you can safely ignore while working on any one section of code.
Classes are the primary tool for accomplishing that objective.
Abstraction is the ability to engage with a concept while ignoring some of its detailshandling different details at different levels.
The principal benefit of abstraction is that it allows you to ignore irrelevant details.
Encapsulation picks up where abstraction leaves off.
Abstraction says, "You're allowed to look at an object at a high level of detail."
Encapsulation says, "Furthermore, you aren't allowed to look at an object at any other level of detail."
In designing a software system, certain objects are similar to other objects, except for a few differences.
Example: You can define a general type of employee and then derive a full-time employee and part-time employee, based on the differences.
Inheritance combined with polymorphism allows a Derived to inherit from a Base class without having to retain all features of the Base class.
The Derived class can also do some of the things that the Base class does differently.
Templates allow functions and classes to operate with generic types.
This allows a function or class to work on many different data types without being rewritten for each one.
The STL was created as the first library of generic algorithms and data structures for C++, with these ideas in mind: generic programming, abstractness without loss of efficiency.
In the final analysis, although C is one of the world's great programming languages, there is a limit to its ability to handle complexity. Once a program exceeds somewhere between 25,000 and 100,000 lines of code, it becomes so complex that it is difficult to grasp as a totality.
C++ allows this barrier to be broken, and helps the programmer comprehend and manage larger programs.