Session_1 - Lesson 1 Getting Started Until recently,...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Lesson 1 – Getting Started Until recently, programs were thought of as a series of procedures that acted upon data. The essence of object-oriented programming is to treat data and the procedures that act upon the data as a single “object”—a self-contained entity with an identity and certain characteristics of its own. C++ fully supports object-oriented programming which includes the following: Encapsulation Inheritance Polymorphism Encapsulation is the property of being a self-contained unit. With encapsulation we can accomplish data hiding. Data hiding is the highly valued characteristic that an object can be used without the user knowing or caring how it works internally. C++ supports the properties of encapsulation through the creation of user-defined types, called classes . Inheritance allows for the extension of an existing type (reuse existing code). The new subclass derives from an existing type and is sometimes called a derived type. Polymorphism is the ability of allowing C++ to support the concept that different objects do “the right thing”. There is function polymorphism and class polymorphism. Poly means many, and morph means form. Polymorphism refers to the same name taking many forms. C++ was invented by Bjarne Stroustrup, Bell Lab, 1980s, who used “C” as the base language. C++ is a superset of C and virtually any legal C program is a legal C++ program, but the leap from C to C++ is significant. It is true that you can learn C++ without C. The ANSI Standard (American National Standards Institute) has created an international standard for C++. The C++ Standard is now also referred to as ISO (International Standards Organization) Standard. Also called the X3 Standard and ANSI/ISO Standard. Text Book uses the ANSI standard term. Development Environment Save your files as “cpp” or “cxx” depending on the compiler. Don’t use a word processor that saves special formatting characters. If you do, save the file as ASCII text. As you compile the source code, an object file is produced. The file often has the extension “.obj” which is not an executable program. To turn the “obj” file into an executable file, you must link it. Page 1 of 8
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
So the process is: Create a source code file with a “.cpp” extension. Compile the source code into a file with the “obj” extension. Link the “obj” with any needed libraries to produce an executable program. Hello.cpp – First C++ Program
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

Session_1 - Lesson 1 Getting Started Until recently,...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online