C++ Programming

Download Report

Transcript C++ Programming

C++ Programming
Table of Contents
•
•
•
•
•
History
What is C++?
Development of C++
Standardized C++
What are the features
of C++?
• What is Object
Orientation?
• Encapsulation
• Java and C++
• Advantages and
Disadvantages
• The future of C++
History
• The name C++ was created by Rick Mascitti
and was first used in December of 1983.
• Stroustrup worked on “C” in 1979.
• Wanted to develop a language to enhance
software development.
• He chose “C” because it is general-purpose,
fast and portable.
• He later enhanced “C” and it became C++.
What is C++
• C++ programming is a programming
language designed to making
programming more enjoyable for the
serious programmer.
• In the 1990s it became one of the most
popular programming languages in the
world.
Development
• C++, designed by Bell Lab’s Bjarne
Stroustup, was developed as an
enhancement to the C programming
language.
• Enhancements Included the addition of
classes followed by many features such as:
–
–
–
–
–
Virtual functions
Operator overloading
Multiple Inheritance
Templates
Exception handling
Standardized C++
• In 1998 C++ Programming became
standardized
• It consists of Two parts:
– Core Language - pure programming language,
generally organized into statement blocks; the
core language is often developed into libraries,
which are then used during programming.
– Standard Library - a collection of classes and
functions; which are written in the core language.
The Standard Library includes functions for data
conversion, input, output, string manipulation,
and other procedures.
Features of C++
• Features of C++ include an improved
version of C:
– Function casts
– New / Delete
– Default arguments
– Function overloading
– Name spaces
– Templates
Object Oriented Features of C++
• C++ introduces object oriented features to C.
• Object orientation is a computer programming
paradigm that emphasizes on:
• Objects - packaging data and functionality together
into units within a running computer program.
• Abstraction - combining multiple smaller operations
into a single unit that can be referred to by name
• Polymorphism - using the same name to invoke
different operations on objects of different data
types.
• Inheritence - defining objects data types as
extensions and/or restrictions of other object data
types.
Encapsulation And What It Does
• C++ allows all members of a class to be declared
public, private or protected.
• Encapsulation describes- leaving out some details of
implementation on purpose from the public
• Public member - Member of the class that will be
accessible to every other class.
• Private - will only be accessible within that class.
• Protected - will only be accessible to the class in
which it is in and the classes that inherit said class
Java and C++
• Java is considered a much simpler and easy to use
object-oriented programming language when compared
to the popular programming language, C++.
• Java replaced the complexity of multiple inheritance in
C++ with a simple structure called interface, and also
has eliminated the use of pointers.
• Java uses automatic memory allocation and garbage
collection.
• C++ requires the programmer to allocate memory and to
collect garbage
Advantages of C++
• C++ Has compiler support and debuggers.
• C++ Has a large selection of literature
• One class can have more than one base
class, which is referred to as
Polymorphism.
Disadvantages of C++
• Not available on OS9
• C++ is difficult to learn and can often
become confusing.
• Extensive use on some features such as,
Operator overloading, Function
overloading, and virtual functions can
make C++ unreadable.
• Executables are large (500kb) compared
to OIC (150kb).
Future Development
• C++ continues to evolve to meet future
requirements.
• C++ will capitalize on its multi-paradigm
nature more.
• Name decoration and making object code
produced by different compilers
incompatible are still lacking in C++
standard.
Future Development
• Ports to platforms such as Solaris and
Linux.
• More use of “Inline Functions”.