Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 1Winter Quarter C++ Lecture 24.

Slides:



Advertisements
Similar presentations
Chapter 8 Technicalities: Functions, etc. Bjarne Stroustrup
Advertisements

When is Orientated Programming NOT? Mike Fitzpatrick.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 12P. 1Winter Quarter User-Written Functions.
Engineering EG167C - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect M1 P. 1Winter Quarter Midterm I Review.
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
Inheritance Definition Relationships Member Access Control Data Encapsulation Overloading vs. Overriding Constructors & Destructors.
1 CS 201 Introduction to c++ (1) Debzani Deb. 2 History of C++ Extension of C (C++ for better C) Early 1980s: Bjarne Stroustrup (Bell Laboratories) Provides.
Object Oriented Programming A brief review of what you should know about OOP.
C Programming Basics Lecture 5 Engineering H192 Winter 2005 Lecture 05
C++ data types. Structs vs. Classes C++ Classes.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 15 - C++ As A "Better C" Outline 15.1Introduction.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 6P. 1Winter Quarter I/O in C Lecture 6.
Introduction to C++CS-2303, C-Term Introduction to C++ CS-2303 System Programming Concepts (Slides include materials from The C Programming Language,
 2007 Pearson Education, Inc. All rights reserved C++ as a Better C; Introducing Object Technology.
C++ fundamentals.
Object Oriented Programming C++. ADT vs. Class ADT: a model of data AND its related functions C++ Class: a syntactical & programmatic element for describing.
Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 28P. 1Winter Quarter Inheritance and Overloading.
Introduction to C++ Systems Programming.
You gotta be cool. C++ ? C++ Standard Library Header Files Inline Functions References and Reference Parameters Default Arguments and Empty Parameter.
EC-241 OBJECT-ORIENTED PROGRAMMING (OOP)
Classes Mark Hennessy Dept. Computer Science NUI Maynooth C++ Workshop 18 th – 22 nd Spetember 2006.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
Chapter 11: Inheritance and Composition. Objectives In this chapter, you will: – Learn about inheritance – Learn about derived and base classes – Redefine.
Object Oriented Programming CS160 - OOP. Objects Objects are a Objects are a way to organize and conceptualize a program as a set of interacting objects.
Introduction to C++ Systems Programming. Systems Programming: Introduction to C++ 2 Systems Programming: 2 Introduction to C++  Syntax differences between.
Rossella Lau Lecture 1, DCO10105, Semester B, DCO10105 Object-Oriented Programming and Design  Lecture 1: Introduction What this course is about:
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 25P. 1Winter Quarter C++: I/O and Classes Lecture 25.
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
ADTs and C++ Classes Classes and Members Constructors The header file and the implementation file Classes and Parameters Operator Overloading.
Data Structures Using C++ 2E1 Inheritance An “is-a” relationship –Example: “every employee is a person” Allows new class creation from existing classes.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
Lecture 19 CIS 208 Wednesday, April 06, Welcome to C++ Basic program style and I/O Class Creation Templates.
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 16: Introduction to C++
1 OOP - An Introduction ISQS 6337 John R. Durrett.
CSci 162 Lecture 10 Martin van Bommel. Procedures vs Objects Procedural Programming –Centered on the procedures or actions that take place in a program.
نظام المحاضرات الالكترونينظام المحاضرات الالكتروني Introduction to Object Oriented Programming (OOP) Object Oriented programming is method of programming.
1 CSE Programming in C++. 2 Overview Sign roster list Syllabus and Course Policies Introduction to C++ About Lab 1 Fill Questionnaire.
Object Oriented Programming Session # 03.  Abstraction: Process of forming of general and relevant information from a complex scenarios.  Encapsulation:
Chapter 11: Inheritance and Composition. Introduction Two common ways to relate two classes in a meaningful way are: – Inheritance (“is-a” relationship)
DEF & FACTS! C + 1 = C++ C & C++ ARE MIDDLE LEVEL LANGUAGES INTRODUCTION BRIEF REVIEW OF C NEED OF C++ © arbit club cu 2010.
Object-Oriented Programming (OOP) and C++
Structure A Data structure is a collection of variable which can be same or different types. You can refer to a structure as a single variable, and to.
CS116 SENEM KUMOVA METİN. Outline What is C++ ? Some features of C++ Input and Output Operations Manipulators C++ header files Namespaces and scope resolution.
1 C++ Classes & Object Oriented Programming Overview & Terminology.
CPS120: Introduction to Computer Science Lecture 16A Object-Oriented Concepts.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Chapter 15 - C++ As A "Better C"
Introduction to C++ (Extensions to C)
Introduction to C++ Systems Programming.
CS3340 – OOP and C++ L. Grewe.
C++ Classes & Object Oriented Programming
About the Presentations
Object-Orientated Programming
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
(5 - 1) Object-Oriented Programming (OOP) and C++
Chapter 8: Introduction to High-Level Language Programming
Object-Oriented Programming
Object-Oriented Programming
(5 - 1) Object-Oriented Programming (OOP) and C++
Principles of object – oriented programming UNIT-1 Chapter-1.
Object Oriented Programming
Chapter 11: Inheritance and Composition
Object-Oriented Programming
Chapter 15 - C++ As A "Better C"
CPS120: Introduction to Computer Science
C++ data types.
C++ Object Oriented 1.
Presentation transcript:

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 1Winter Quarter C++ Lecture 24

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 2Winter Quarter C++ A better C A superset of C Created at Bell Labs in the 1980's and called C with Classes Adds additional features to improve the language Adds functions and features to support Object Oriented Programming (OOP )

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 3Winter Quarter Object Oriented Programming (OOP) Object oriented programming (OOP) models real- world objects with software counterparts. OOP gives us a more natural and intuitive way to view the programming process by modeling the real-world objects, their attributes, their behaviors, and their interactions with each other.

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 4Winter Quarter Object Oriented Programming (OOP) OOP also models communication between objects. Just as people send messages to one another, objects communicate via messages. OOP encapsulates data (attributes) and functions (behavior) into packages called objects. Objects have the property of information hiding.

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 5Winter Quarter Object Oriented Programming (OOP) cont. Objects (data and functions) are members of user-defined types called classes. A class definition is an extension of a C struct definition. It is made up of declarations of variables and of function prototypes to manipulate those variables. The variables are typically declared to be private or protected and the functions are typically declared to be public. structs and classes actually are the same in C++ (both can have member functions or “methods”), but struct members are public by default and class members are private by default.

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 6Winter Quarter Useful Concepts in C++ Inheritance Operator overloading Function templates Virtual functions Polymorphism

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 7Winter Quarter New I/O library iostream header file library #include // No “.h” in front of // standard headers using namespace std; // To prevent “std::” // before everything contains definitions for several classes istreamostream fstreamios and their associated objects cincout cerrclog

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 8Winter Quarter Some New Operators in C++ >> Extraction Operator extracts data from input stream. << Insertion Operator inserts data into output stream :: Scope Resolution Operator used to: 1. Override the default scope of variables. 2. Specify the scope of member functions.

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 9Winter Quarter Some C++ Extensions to C // Single Line Source Code Comments Inline Functions Function overloading Reference parameters

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 10Winter Quarter // Single Line Comments // This is a comment that covers // more than one line. It // requires double slashes on // each line.

Engineering H192 - Computer Programming The Ohio State University Gateway Engineering Education Coalition Lect 24P. 11Winter Quarter Inline Functions inline float cube ( float x ) { return x*x*x;} // This solves problems that arise with #define cube(x) x*x*x