Copyright 2005, The Ohio State University CSE 459.22 – Introduction to C++ Name: Shirish Tatikonda Time: T 3:30 PM Room: BE 394

Slides:



Advertisements
Similar presentations
Object-Oriented Programming Session 9 Course : T Programming Language Concept Year : February 2011.
Advertisements

Object Oriented Programming
OO Programming in Java Objectives for today: Overriding the toString() method Polymorphism & Dynamic Binding Interfaces Packages and Class Path.
Object-Oriented Programming Python. OO Paradigm - Review Three Characteristics of OO Languages –Inheritance It isn’t necessary to build every class from.
Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
Object Oriented Programming in Java. Object Oriented Programming Concepts in Java Object oriented Programming is a paradigm or organizing principle for.
1 COSC2767: Object-Oriented Programming Haibin Zhu, Ph. D. Associate Professor of CS, Nipissing University.
Informática II Prof. Dr. Gustavo Patiño MJ
ITEC200 – Week03 Inheritance and Class Hierarchies.
Stéphane Ducasse6.1 Essential Concepts Why OO? What is OO? What are the benefits? What are the KEY concepts? Basis for all the lectures.
1 Introduction to C++ Programming Concept Basic C++ C++ Extension from C.
WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
C++ fundamentals.
OBJECT ORIENTED PROGRAMMING
1 Review: Two Programming Paradigms Structural (Procedural) Object-Oriented PROGRAM PROGRAM FUNCTION OBJECT Operations Data OBJECT Operations Data OBJECT.
Introduction To System Analysis and design
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.
Object Oriented Programming Development
Introduction to Object-oriented programming and software development Lecture 1.
CSE 332: C++ templates This Week C++ Templates –Another form of polymorphism (interface based) –Let you plug different types into reusable code Assigned.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
Features of Object Oriented Programming Lec.4. ABSTRACTION AND ENCAPSULATION Computer programs can be very complex, perhaps the most complicated artifact.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
Object Oriented Programming Elhanan Borenstein copyrights © Elhanan Borenstein.
Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer.
OOP Class Lawrence D’Antonio Lecture 3 An Overview of C++
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
Design.ppt1 Top-down designs: 1. Define the Problem IPO 2. Identify tasks, Modularize 3. Use structure chart 4. Pseudocode for Mainline 5. Construct pseudocode.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Chapter 10 Inheritance and Polymorphism
Lecture 12 March 16, The Scope of a Variable What if there are two variables with the same name? –A local or block-local variable can have the same.
Introduction to c++ programming - object oriented programming concepts - Structured Vs OOP. Classes and objects - class definition - Objects - class scope.
CS 3050 Object-Oriented Analysis and Design. Objectives What is “Object-Oriented?” Object-Oriented Approach Vs. Structured Approach How Has the Object-Oriented.
Lecture 19 CIS 208 Wednesday, April 06, Welcome to C++ Basic program style and I/O Class Creation Templates.
: Maha Sabri Altememe Lecturer : Maha Sabri Altememe Lecture :1 1.
Session 24 Chapter 12: Polymorphism. Polymorphism polymorphism comes from the Greek root for “many forms” polymorphism is about how we can use different.
Salman Marvasti Sharif University of Technology Winter 2015.
1 OOP - An Introduction ISQS 6337 John R. Durrett.
Copyright 2006 Oxford Consulting, Ltd1 January Introduction to C++ Programming is taking A problem Find the area of a rectangle A set of data.
Lecture 2: Review of Object Orientation. © Lethbridge/La ganière 2005 Chapter 2: Review of Object Orientation What is Object Orientation? Procedural.
1 CSE Programming in C++. 2 Overview Sign roster list Syllabus and Course Policies Introduction to C++ About Lab 1 Fill Questionnaire.
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
OOPS CONCEPT.  OOPS  Benefits of OOPs  OOPs Principles  Class  Object Objectives.
Object-Oriented Programming (OOP) and C++
Introduction to Object Oriented Programming Lecture-3.
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.
1 n Object Oriented Programming. 2 Introduction n procedure-oriented programming consists of writing a list of instructions and organizing these instructions.
1 C++ Classes & Object Oriented Programming Overview & Terminology.
CSCE 240 – Intro to Software Engineering Lecture 3.
Computer Programming II Lecture 5. Introduction to Object Oriented Programming (OOP) - There are two common programming methods : procedural programming.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
Modern Programming Tools And Techniques-I
Object-Oriented Design
Object Oriented Programming F3031
Sections Basic Concepts of Programming
Review: Two Programming Paradigms
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
Lecture 1 Introduction.
Object Oriented Programming
Object Oriented Analysis and Design
Principles of object – oriented programming UNIT-1 Chapter-1.
UNIT I OBJECT ORIENTED PROGRAMMING FUNDAMENTALS
CPS120: Introduction to Computer Science
Object-Oriented Programming
CPS120: Introduction to Computer Science
Computer Science II for Majors
Presentation transcript:

Copyright 2005, The Ohio State University CSE – Introduction to C++ Name: Shirish Tatikonda Time: T 3:30 PM Room: BE Office: DL 674 Office Hours: TBD Webpage:

Copyright 2005, The Ohio State University Programming Paradigms Unstructured –goto Structured –Procedures and Functions Object Oriented –Classes, Entities Generic –No specific types and data structures

Copyright 2005, The Ohio State University Procedural Paradigm Decide which procedures you want Use the best algorithms you can find Example: C, Pascal int compute_area (int l, int w) { return ( l * w ); }

Copyright 2005, The Ohio State University Object Oriented Paradigm (OOP) OOP is a decomposition paradigm for program code, not a model for computation. Object interaction is through messages Examples: SIMULA, Smalltalk, C++, Java, Python and C#

Copyright 2005, The Ohio State University Example code class Rectangle { private: int width, length; public: Rectangle(int w, int l) { width = w; length = l; } main() { Rectangle rect(3,5); cout<<rect.area()<<endl; } int area() { return width*length; }

Copyright 2005, The Ohio State University OOP – Key Concepts Class –basis for modularity and structure of the program –represents real-world entity (type), say Dog. Object –an instance of a class (or type), say Doberman –Can be characterized by Identity State Behavior Objects of same class has same data type

Copyright 2005, The Ohio State University OO Perspective of example Class Rectangle abstracts a specific shape Objectrect data - encapsulated width length function ( called a method )- encapsulated area = length * width –Call a method (message) on object, rect to find area. –In C++, rather than writing a procedure, we define a class that encapsulates the knowledge necessary to solve the problem (finding the area of the rectangle).

Copyright 2005, The Ohio State University OOP – Key Concepts Four Pillars –Abstraction: Selective Ignorance –Encapsulation ~ Information Hiding –Inheritance: Hierarchy –Polymorphism: Multiple forms Abstraction: ability of a program to ignore the details of an object's (sub) class and work at desired level –Doberman: Dog – Canidae – Carnivora

Copyright 2005, The Ohio State University Encapsulation (Information Hiding) –Encapsulating object with resources, data & code –Data can be accessed only through code/methods –Code: object’s interface Inheritance (Hierarchy) –Mechanism for creating subclasses (is-a relation) –Subclass acquires data and methods from super class Polymorphism –Multiple forms of behavior for the same method –Type of behavior depends on the place from which method is called

Copyright 2005, The Ohio State University Basic C++ Inherits all ANSI C features You don’t have to do OOP using C++ Comments –/* Single line comment */ –// New style for single line comment –/* Multiple Line Comment */

Copyright 2005, The Ohio State University Use objects to read and write (instead of printf, scanf) cout << "hey"; // no newline charatcter ‘\n’ char name[10]; cin >> name; cout << "Hey " << name << ", nice name." << endl; cout << endl; // print a blank line Declare variables anywhere // declare a variable when you need it for (int k = 1; k < 5; k++) { cout << k ; }

Copyright 2005, The Ohio State University Const –Replacement for #define in C –Interpreted by the compiler –Type checking is applied –Should be initialized. (const int i; // error) References –Alternate names for an object –Initialization should be done along with declaration int i =1; int & r = i; // r is reference to i int & e = 1; // error: should be an lvalue rr++; // equivalent of i++

Copyright 2005, The Ohio State University Function Overloading –Functions with same name (within same scope) can exist as long as signature differs –Signature: number, type, and order (??) of arguments (return type is not included) –Name + Signature uniquely identifies a function (within one scope)` –int foo(int p1, char p2 ); Vs int foo(char p1, char p2); –char foo(char p1, char p2 ); Vs int foo(char p1, char p2);

Copyright 2005, The Ohio State University Summary OOP is one of the many programming paradigms Classes & Objects Four Pillars of OOP References Function Overloading