ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Spring 2013 Lecture 19: Exam 3 Preview.

Slides:



Advertisements
Similar presentations
Constructor. 2 constructor The main use of constructors is to initialize objects. A constructor is a special member function, whose name is same as class.
Advertisements

ECE 264 Object-Oriented Software Development
Object Oriented Programming COP3330 / CGS5409.  C++ Automatics ◦ Copy constructor () ◦ Assignment operator =  Shallow copy vs. Deep copy  DMA Review.
COMP171 Data Structure & Algorithm Tutorial 1 TA: M.Y.Chan.
Operator Overloading in C++ Systems Programming. Systems Programming: Operator Overloading 22   Fundamentals of Operator Overloading   Restrictions.
Rossella Lau Lecture 8, DCO10105, Semester B, DCO10105 Object-Oriented Programming and Design  Lecture 8: Polymorphism & C++ pointer  Inheritance.
16/22/2015 2:54 PM6/22/2015 2:54 PM6/22/2015 2:54 PMObject-Oriented Development Concept originated with simulating objects and their interactions. Adapted.
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
Lecture 9 Concepts of Programming Languages
More Classes in C++ Bryce Boe 2012/08/20 CS32, Summer 2012 B.
Operator Overloading in C++
Review of C++ Programming Part II Sheng-Fang Huang.
Computer Science and Software Engineering University of Wisconsin - Platteville 7. Inheritance and Polymorphism Yan Shi CS/SE 2630 Lecture Notes.
CSE 332: C++ templates and generic programming I Motivation for Generic Programming in C++ We’ve looked at procedural programming –Reuse of code by packaging.
OOP Languages: Java vs C++
Chapter 12: Adding Functionality to Your Classes.
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.
CSE 333 – SECTION 4. Overview Pointers vs. references Const Classes, constructors, new, delete, etc. More operator overloading.
Learners Support Publications Pointers, Virtual Functions and Polymorphism.
CSE 425: Object-Oriented Programming II Implementation of OO Languages Efficient use of instructions and program storage –E.g., a C++ object is stored.
Data Structures Using C++ 2E Chapter 3 Pointers and Array-Based Lists.
Dr. Ahmad R. Hadaegh A.R. Hadaegh California State University San Marcos (CSUSM) Page 1 Virtual Functions Polymorphism Abstract base classes.
CSE 332: C++ templates This Week C++ Templates –Another form of polymorphism (interface based) –Let you plug different types into reusable code Assigned.
Inheritance Joe Meehean. Object Oriented Programming Objects state (data) behavior (methods) identity (allocation of memory) Class objects definition.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 4: Continuing with C++ I/O Basics.
Programming Languages and Paradigms Object-Oriented Programming (Part II)
 2006 Pearson Education, Inc. All rights reserved Classes: A Deeper Look, Part 2.
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
CS212: Object Oriented Analysis and Design Lecture 7: Arrays, Pointers and Dynamic Memory Allocation.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 26: Exam 2 Preview.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
ICOM 4035 – Data Structures Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department Lecture 4 – August 30, 2001.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 8: Class Relationships Data Abstraction & Problem Solving.
Data Structures Using C++ 2E Chapter 3 Pointers. Data Structures Using C++ 2E2 Objectives Learn about the pointer data type and pointer variables Explore.
Copyright 2006 Oxford Consulting, Ltd1 February Polymorphism Polymorphism Polymorphism is a major strength of an object centered paradigm Same.
CPSC 252 The Big Three Page 1 The “Big Three” Every class that has data members pointing to dynamically allocated memory must implement these three methods:
Object-Based Programming Mostly Review. Objects Review what is object? class? member variables? member functions? public members? private members? friend.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Spring 2013 Lecture 5: Continuing with C++ I/O Basics.
COP INTERMEDIATE JAVA Designing Classes. Class Template or blueprint for creating objects. Their definition includes the list of properties (fields)
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 31: Operator overloading examples, inheritance intro.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 24: Pointers and Dynamic Allocation.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 29: Operator overloading.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 15: Overloading and Templates.
Object-Oriented Programming (OOP) What we did was: (Procedural Programming) a logical procedure that takes input data, processes it, and produces output.
Chapter 1 C++ Basics Review (Section 1.4). Classes Defines the organization of a data user-defined type. Members can be  Data  Functions/Methods Information.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Spring 2013 Lecture 18: More on inheritance and Polymorphism.
Introduction to Classes in C++ Instructor - Andrew S. O’Fallon CptS 122 Washington State University.
Recap Introduction to Inheritance Inheritance in C++ IS-A Relationship Polymorphism in Inheritance Classes in Inheritance Visibility Rules Constructor.
Final Exam ECE562/468 Advanced Computer Architecture Prof. Honggang Wang ECE Department University of Massachusetts Dartmouth 285 Old Westport Rd. North.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 24: Pointers and Dynamic Allocation.
Copyright © 2012 Pearson Education, Inc. Chapter 10 Advanced Topics.
ECE 264 Object-Oriented Software Development
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Spring 2013 Lecture 16: Destructors, Copy Constructors and Exam 2 Review.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Spring 2013 Lecture 19: Abstract Classes.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 13: Exam 1 Preview.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Spring 2013 Lecture 17: Operator overloading and inheritance intro.
Object-Oriented Programming Review 1. Object-Oriented Programming Object-Oriented Programming languages vary but generally all support the following features:
Abstract classes only used as base class from which other classes can be inherit cannot be used to instantiate any objects are incomplete Classes that.
Learning Objectives Pointers as dada members
Andy Wang Object Oriented Programming in C++ COP 3330
CMSC202 Computer Science II for Majors Lecture 08 – Overloaded Constructors Dr. Katherine Gibson Based on slides by Chris Marron at UMBC.
Constructor & Destructor
Inheritance Often, software encapsulates multiple concepts for which some attributes/behaviors overlap E.g. A computer (role-playing) game has: Monsters:
CISC/CMPE320 - Prof. McLeod
EECE.2160 ECE Application Programming
Instructor: Dr. Michael Geiger Spring 2019 Lecture 13: Exam 1 Preview
Instructor: Dr. Michael Geiger Spring 2017 Lecture 12: Exam 1 Preview
Instructor: Dr. Michael Geiger Spring 2019 Lecture 23: Exam 2 Preview
Presentation transcript:

ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Spring 2013 Lecture 19: Exam 3 Preview

Lecture outline Announcements/Reminders  Project demos due April 25 (Thursday) and April 30 (Tuesday) Entire group members must attend Presentation order: Group 5, Group1-4, Group 6, 3:30 – 4:45 PM, April 25 Presentation order: Group 7-Group 11, 3:30 – 4:45 PM, April 30  Project documentation (Source code, user’s guide, tech report) due at 11:59:59 PM, May 1 st ( submission)  Student evaluations on others’ project (1-poor; 2-fair; 3-good; 4-very good; 5- excellent): General exam information  Q & A Friday 2:00 -3:30 pm  Exam review: what we’ve covered since the last exam (not an exhaustive list!)  Destructors  Copy constructors  Operator overloading  Inheritance Basics of base/derived classes Use of constructors Virtual functions Pure virtual functions & abstract classes 11/21/2015 ECE 264: Lecture 19 2

General exam information You may also use paper-based materials such as lecture notes (printed), textbooks and other related materials. One 8.5” x 11” double-sided sheet of notes allowed All electronic devices (e.g., cellular phones, PDAs) and Computer are prohibited. Exam time: Thursday, May 9, 3:00 PM - 6:00 PM Start as close to 3:00 pm (May 09) as possible and last 3 hours Exam will be held in  Room S&E 222 (Monday session group)  Room S&E 214 (Wednesday session group) 3 questions, most of which have multiple parts  Short answer  Fill-in-the-blank  Understanding code (i.e., given some code, what’s output/what values do variables have?)  Writing short code sequences Sample exam3 on web site (“Exam 3 sample”) under “Schedule and Materials”“Exam 3 sample  Should at least give you idea of format  Note that topics were covered in a slightly different manner in previous years  It could cover all the lectures. Some similar questions will be picked up from previous exams (exam 1 and 2)  Be family with questions or sample questions of Exam 1, Exam 2 and Exam 3 11/21/2015 ECE 264: Lecture19 3

Review: Destructors Destructors called when object destroyed; used for “object cleanup”  At end of function  When delete is used to deallocate object Often empty, unless object contains dynamically allocated data  Destructor is responsible for deleting that data Syntax: class-name::~class-name() { } 11/21/2015 ECE 264: Lecture 16 4

Review: Copy constructors Called when new object created from existing object  Example: Point p2 = p1;  Default is shallow copy  Need deep copy if object contains Array(s) Dynamically allocated data Must still copy all data members  Syntax: class_name::class_name(const class_name & )  Example: tenInts::tenInts(const tenInts &t){ for (int i=0; i < 10; i++) arr[i] = t.arr[i]; } 11/21/2015 ECE 264: Lecture 37 5

Review: Operator overloading Allows use of built-in operators with user-defined types Definitions for overloaded operators included in class definition  Example (from Point class) double operator –(const Point& rhs);  Syntax: Keyword operator is used, followed by the actual operator “Argument” is an object reference of the same type const declarations are optional but often preferred  Syntax exceptions: friend functions Has access to class data, but not technically part of class Used if LHS of operation is not of same type as class Example: stream operators (e.g. cin >> h1; ) Both sides (of binary operator) must be specified as “arguments” 11/21/2015 ECE 264: Lecture 37 6

Review: Inheritance Create new class (derived class) from existing class (base class)  Base class has functionality shared by derived class  Can add functions to derived class  Can customize base class functionality  Can have inheritance hierarchy Syntax example using Rectangle/Square  In Square.h, declare class as: class Square : public Rectangle Default constructor for a base class is called automatically in the derived class constructor  Ex: Square() calls Rectangle()  Will actually traverse inheritance hierarchy, starting at lowest class If derived class needs the parameterized constructor of base class, must explicitly invoke it in initialization list  Ex: Square::Square(const Point &p, double s) : Rectangle(s, s, p.getX(), p.getY()) Access visibility: for data/functions to be visible to base & derived class(es), but not clients, declare as protected 11/21/2015 ECE 264: Lecture 37 7

Review: Polymorphism/virtual functions Polymorphism: Code/operations behave differently in different contexts  One example: operator overloading  Inheritance-based polymorphism in form of virtual functions Virtual functions allow us to write generic code that works for (hopefully) many specific cases  Using pointers to objects allows dynamic binding Base class pointer can be used for derived class object ptr->function() will call version for appropriate class Also useful when  Passing function arguments by reference  Calling member function inside another member function (implicitly using this pointer) Remember, a class with virtual functions should have a virtual destructor 11/21/2015 ECE 264: Lecture 37 8

Review: Abstract classes Abstract classes give ability to specify generic class  At least some base class functionality is too general to implement  use pure virtual function Having pure virtual function(s) makes class abstract Cannot instantiate object of abstract class type  Pure virtual function syntax (in.h file): virtual ( ) = 0; Derived classes must overload pure virtual functions  Failure to do so makes derived class abstract! 11/21/2015 ECE 264: Lecture 37 9

Dr. Wang Lecture #19 10 Student Evaluation Instructions Print TA Justin last name Lacle in the STUDENT NAME box. There is NO need to fill in the corresponding ovals. Print course and section number (for ECE264) in the first 5 positions of the STUDENT ID NUMBER box. There is NO need to fill in the corresponding ovals. Queries on the Questionnaire are matched to the numbers on the Answer Sheet. E: Strongly Agree; D: Agree; C: Neutral; B: Disagree; A: Strongly Disagree