CS 246: Software Abstraction and Specification. Lecture 8. Object Composition
|
|
- Barnard Welch
- 6 years ago
- Views:
Transcription
1 CS 246: Software Abstraction and Specification Lecture 8 Object Composition Agenda: Object Composition Implementing Composite Objects "Law" of Demeter Reading: Eckel, Vol. 1 Ch. 14 Inheritance and Composition References Lieberher et al. Formulations and Benefits of the Law of Demeter", ACM SIGPLAN Notices, March 1989 Herb Sutter and Andrei Alexandrescu, C++ Coding Standards U Waterloo CS246se (Spring 2011) p.1/20
2 Review: Aggregation vs. Composition Transcript GPA 1..* Term Record term termgpa academic standing * enrollment 1 Program name U Waterloo CS246se (Spring 2011) p.2/20
3 Optional Unshared Component Address street no. street name unit no. city province postal code country local 0..1 Student Record name studentid Design decisions: data representation of component? initial value of component? is StudentRecord object responsible for creating/destroying associated Address object? is StudentRecord copy constructor a deep or shallow copy? U Waterloo CS246se (Spring 2011) p.3/20
4 class Address; Optional Component class StudentRecord { public: StudentRecord(string name, int id, Address* addr = 0); //... private: StudentRecord(StudentRecord&); string name_; int id_; Address *local_; //... }; // pointer member StudentRecord::StudentRecord(string n, int i, Address *a) : name_ (n), id_ (i), local_(a) { } StudentRecord::~StudentRecord() { delete local_; } U Waterloo CS246se (Spring 2011) p.4/20
5 Exactly One Unshared Component Address street no. street name unit no. city province postal code country 1 permanent Student Record name studentid Design decisions: data representation of component? initial value of component? is StudentRecord object responsible for creating/destroying components? U Waterloo CS246se (Spring 2011) p.5/20
6 Initializers for Object Data Members #include "Address.h" class Transcript; class StudentRecord { public: StudentRecord(string name, int id, Address *l, Address &p); //... private: string name_; int id_; Address *local_; // pointer data member //... }; Address perm_; // object data member StudentRecord::StudentRecord (..., Address *l, Address &p) : //..., local_(l), perm_ (p), // calls member's copy constructor //... U Waterloo CS246se (Spring 2011) p.6/20
7 One-to-One Association Student Record 1 1 Transcript name GPA studentid Design decisions: data representation of associated object(s)? initial value of associated object(s)? is StudentRecord object responsible for creating/destroying components? U Waterloo CS246se (Spring 2011) p.7/20
8 One-to-One Association class StudentRecord; class Transcript { public: Transcript(StudentRecord&); private: StudentRecord &sr_; float GPA_; }; Transcript::Transcript(StudentRecord &s) : sr_(s), GPA_(0.0) {} StudentRecord::StudentRecord (..., Address *l, Address &p) :... local_(l), perm_ (p), // calls member's (copy) constructor transcript_(*(new Transcript(*this))) // constructs trans { } U Waterloo CS246se (Spring 2011) p.8/20
9 StudentRecord s; Object Construction Object is built inside out: components before composite - in the order they are declared in the class declaration s: StudentRecord cout s.name_:string name_(n) id_(i) perm_(a) s.id_ : int s:local_:address // components of Address transcript_(* new Transcript))... s:transcript_:transcript // components of Transcript << "Inside constructor body" U Waterloo CS246se (Spring 2011) p.9/20
10 Collection of Components Work Term employer term evaluation coop history 0..6 Transcript 1..* GPA Term Record term termgpa academic standing Design Decisions: data representation of components? container of objects or of pointers to objects? initial value of associated object(s)? is Transcript object responsible for creating/destroying components? U Waterloo CS246se (Spring 2011) p.10/20
11 Collection of Components class StudentRecord; class TermRecord; class WorkTerm; class Transcript { public: Transcript(StudentRecord&); void addtermrecord(string term); void addworkterm (int wtnum, string, string, string); private: StudentRecord &sr_; float GPA_; vector<termrecord*> academic_; // vector of TermRecord* WorkTerm *work_[6]; // array of WorkTerm* }; Transcript::Transcript(StudentRecord &sr) : sr_(sr), GPA_(0.0), academic_(0), // call to vector constructor (size = 0) work_() // initialize array elements to NULL { } U Waterloo CS246se (Spring 2011) p.11/20
12 Composite Creates Components void Transcript::addTermRecord(string term) { TermRecord *tr = new TermRecord(term, 0.0, ""); academic_.push_back(tr); } void Transcript::addWorkTerm (int wtnum, string term, string employer, string eval) { work_[wtnum] = new WorkTerm(term, employer, eval); } U Waterloo CS246se (Spring 2011) p.12/20
13 Shared Components Term Record term termgpa academic standing * enrollment 1 Program name Design decisions: data representation of component? initial value of component? U Waterloo CS246se (Spring 2011) p.13/20
14 Shared Components class TermRecord { string term_; float termgpa_; string academicstanding_; Program &enrollment_; // reference object member public: TermRecord (string term, float GPA, string as, Program &p); //... }; TermRecord::TermRecord(string t, float g, string as, Program &p) : term_(t), termgpa_(g), academicstanding_(as), enrollment_(p) // reference must be set in initializer { } U Waterloo CS246se (Spring 2011) p.14/20
15 Composition and Data Encapsulation Address street no. street name unit no. city province postal code country permanent 1 local 0..1 Student Record name ID 1 Work Term employer term evaluation coop history Transcript GPA 1..* Term Record term termgpa academic standing * enrollment 1 Program name Information Hiding: Modular design should hide design and implementation details, including information about components. 1..* Course Enrollment grade credits earned * 1 Course number description credits U Waterloo CS246se (Spring 2011) p.15/20
16 Composition and Data Encapsulation GPA Transcript addtermrecord (term) computetermgpa (term) printtermrecord (term) 1..* TermRecord term termgpa academic standing - TermRecord (term) - computegpa() : float - print() vs. GPA Transcript addtermrecord(termrecord) TermRecord& trecord (term) 1..* TermRecord term termgpa academic standing + TermRecord (term) + computegpa() : float + print() Client Code Transcript *t;... t->addtermrecord("spring2011"); t->computetermgpa("spring2011"); t->printtermrecord("sring2011"); Client Code Transcript *t; TermRecord *tr;... tr = t->gettermrecord("spring2011"); tr->computegpa(); tr->print(); U Waterloo CS246se (Spring 2011) p.16/20
17 Composition and Data Encapsulation GPA Transcript addtermrecord (term) computetermgpa (term) printtermrecord (term) 1..* TermRecord term termgpa academic standing - TermRecord (term) - computegpa() : float - print() vs. GPA Transcript addtermrecord(termrecord) TermRecord& trecord (term) 1..* TermRecord term termgpa academic standing + TermRecord (term) + computegpa() : float + print() Client Code Composite object offers Transcript *t;... t->addtermrecord("spring2011"); methods for accessing and t->computetermgpa("spring2011"); manipulating component t->printtermrecord("sring2011"); information. Client Code Transcript *t; TermRecord *tr;... tr = t->gettermrecord("spring2011"); tr->computegpa(); tr->print(); U Waterloo CS246se (Spring 2011) p.17/20
18 Another Example client code Store 1 composite object * Customer + pay (total) * PayPal Account 1..* + pay (total) CreditCard + charge (total) void Store::settlebill(float total) {... Customer->getPayPal()->getCreditCard()->charge(total);... } U Waterloo CS246se (Spring 2011) p.18/20
19 Component Encapsulation client code Store 1 composite objects * Customer +pay (total) * PayPal Account - pay (total) 1..* CreditCard - charge (total) void Store::settlebill(float total) {... Customer->pay(total);... } U Waterloo CS246se (Spring 2011) p.19/20
20 "Law" of Demeter G B E b: B c: C x: int m1 (D) m2 ( ) A D C F H I Limit of A's direct dependencies. "Law" tests encapsulation: an object "talks only to its neighbours" Method A::m1 can only call methods of A itself Aʼs data members m1ʼs parameters any object created by m1 not methods of other classes (unless already allowed by above conditions) (e.g., not methods of an object simply because object is returned by a method call) U Waterloo CS246se (Spring 2011) p.20/20
Today's Agenda. References. Open Closed Principle. CS 247: Software Engineering Principles. Object-Oriented Design Principles
CS 247: Software Engineering Principles Reading: none Object-Oriented Design Principles Today's Agenda Object-Oriented Design Principles - characteristics, properties, and advice for making decisions that
More informationConstants, References
CS 246: Software Abstraction and Specification Constants, References Readings: Eckel, Vol. 1 Ch. 8 Constants Ch. 11 References and the Copy Constructor U Waterloo CS246se (Spring 2011) p.1/14 Uses of const
More informationDesign Patterns (Composite, Iterator)
CS 246: Software Abstraction and Specification Lecture 17 Design Patterns (Composite, Iterator) Reading: Head First Design Patterns U Waterloo CS246se (Spring 2011) p.1/30 Today's Agenda Design patterns:
More informationValue vs. Entity Objects, Information Hiding
CS 247: Software Engineering Principles Value vs. Entity Objects, Information Hiding Readings: Eckel, Vol. 1 Ch. 5 Hiding the Implementation U Waterloo CS247 (Spring 2017) p.1/12 Entity vs. Value Objects
More informationSpecial Member Functions
CS 247: Software Engineering Principles Special Member Functions Readings: Eckel, Vol. 1 Ch. 11 References and the Copy Constructor Ch. 12 Operator Overloading ( operator= ) U Waterloo CS247 (Spring 2017)
More informationSpecial Member Functions. Compiler-Generated Destructor. Compiler-Generated Default Constructor. Special Member Functions
Special Member Functions CS 247: Software Engineering Principles Special Member Functions Readings: Eckel, Vol. 1 Ch. 11 References and the Copy Constructor Ch. 12 Operator Overloading ( operator= ) C++
More informationAbstract Data Types (ADTs) 1. Legal Values. Client Code for Rational ADT. ADT Design. CS 247: Software Engineering Principles
Abstract Data Types (ADTs) CS 247: Software Engineering Principles ADT Design An abstract data type (ADT) is a user-defined type that bundles together: the range of values that variables of that type can
More informationCopy Constructor, Assignment, Equality
CS 246: Software Abstraction and Specification Lecture 4 Copy Constructor, Assignment, Equality Readings: Eckel, Vol. 1 Ch. 11 References and the Copy-Constructor Ch. 12 Operator Overloading (operator=)
More informationCS 247: Software Engineering Principles. ADT Design
CS 247: Software Engineering Principles ADT Design Readings: Eckel, Vol. 1 Ch. 7 Function Overloading & Default Arguments Ch. 12 Operator Overloading U Waterloo CS247 (Spring 2017) p.1/17 Abstract Data
More informationObject-Oriented Programming
References: Beginning Java Objects by Jacquie Barker; Designing Object-Oriented Software by Rebecca Wirfs- Brock;Object-oriented Analysis & Design by Grady Booch; Sara Stoecklin 9/11/2003 1 Object Oriented
More informationObject-Oriented Programming. Objects. Objects. Objects
References: Beginning Java by Jacquie Barker; Designing Object-Oriented Software by Rebecca Wirfs- Brock;Object-oriented Analysis & Design by Grady Booch; Sara Stoecklin Object Oriented Programming defined
More informationCS425 Midterm Exam Summer C 2012
Q1) List five responsibilities of a database-management system. Q2) Fill in the terms in the right hand side of the table that match the description from the list below: Instance SQL Integrity constraints
More informationCSC1322 Object-Oriented Programming Concepts
CSC1322 Object-Oriented Programming Concepts Instructor: Yukong Zhang February 18, 2016 Fundamental Concepts: The following is a summary of the fundamental concepts of object-oriented programming in C++.
More informationWritten by John Bell for CS 342, Spring 2018
Advanced OO Concepts Written by John Bell for CS 342, Spring 2018 Based on chapter 3 of The Object-Oriented Thought Process by Matt Weisfeld, with additional material from other sources. Constructors Constructors
More informationProgramming Language Concepts Object-Oriented Programming. Janyl Jumadinova 28 February, 2017
Programming Language Concepts Object-Oriented Programming Janyl Jumadinova 28 February, 2017 Three Properties of Object-Oriented Languages: Encapsulation Inheritance Dynamic method binding (polymorphism)
More informationJAVA MOCK TEST JAVA MOCK TEST II
http://www.tutorialspoint.com JAVA MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Java Framework. You can download these sample mock tests at your
More informationFINAL TERM EXAMINATION SPRING 2010 CS304- OBJECT ORIENTED PROGRAMMING
FINAL TERM EXAMINATION SPRING 2010 CS304- OBJECT ORIENTED PROGRAMMING Question No: 1 ( Marks: 1 ) - Please choose one Classes like TwoDimensionalShape and ThreeDimensionalShape would normally be concrete,
More informationCollections. Collections Collection types Collection wrappers Composite classes revisited Collection classes Hashtables Enumerations
References: Beginning Java Objects, Jacquie Barker; The Java Programming Language, Ken Arnold and James Gosling; IT350 Internet lectures 9/16/2003 1 Collections Collection types Collection wrappers Composite
More informationConstant Member Functions
Constant Member Functions Does not modify its calling object Declared with keyword const When const appears in the parameter list, e.g., int setnum (const int num) the function is prevented from modifying
More informationa data type is Types
Pointers Class 2 a data type is Types Types a data type is a set of values a set of operations defined on those values in C++ (and most languages) there are two flavors of types primitive or fundamental
More informationLesson 10B Class Design. By John B. Owen All rights reserved 2011, revised 2014
Lesson 10B Class Design By John B. Owen All rights reserved 2011, revised 2014 Table of Contents Objectives Encapsulation Inheritance and Composition is a vs has a Polymorphism Information Hiding Public
More informationCollections. Collections. Collections - Arrays. Collections - Arrays
References: Beginning Java Objects, Jacquie Barker; The Java Programming Language, Ken Arnold and James Gosling; IT350 Internet lectures Collections Collection types Collection wrappers Composite classes
More informationCS304 Object Oriented Programming Final Term
1. Which of the following is the way to extract common behaviour and attributes from the given classes and make a separate class of those common behaviours and attributes? Generalization (pg 29) Sub-typing
More informationCompuScholar, Inc. Alignment to Nevada "Computer Science" Course Standards
CompuScholar, Inc. Alignment to Nevada "Computer Science" Course Standards Nevada Course Details: Course Name: Computer Science Primary Cluster: Information and Media Technologies Standards Course Code(s):
More informationInheritance, and Polymorphism.
Inheritance and Polymorphism by Yukong Zhang Object-oriented programming languages are the most widely used modern programming languages. They model programming based on objects which are very close to
More informationDesign Patterns (Facade, Composite)
CS 247: Software Engineering Principles Design Patterns (Facade, Composite) Reading: Freeman, Robson, Bates, Sierra, Head First Design Patterns, O'Reilly Media, Inc. 2004 Ch 7 Adapter and Facade patterns
More informationCourse Text. Course Description. Course Objectives. StraighterLine Introduction to Programming in C++
Introduction to Programming in C++ Course Text Programming in C++, Zyante, Fall 2013 edition. Course book provided along with the course. Course Description This course introduces programming in C++ and
More informationObject-Oriented Programming Concepts
Object-Oriented Programming Concepts Real world objects include things like your car, TV etc. These objects share two characteristics: they all have state and they all have behavior. Software objects are
More informationC++ (Non for C Programmer) (BT307) 40 Hours
C++ (Non for C Programmer) (BT307) 40 Hours Overview C++ is undoubtedly one of the most widely used programming language for implementing object-oriented systems. The C++ language is based on the popular
More informationWhat is an algorithm?
Reminders CS 142 Lecture 4 ADTs & Objects Program 1 was assigned - Due on 1/27 by 11:55pm Spring 2015 2 Object-Oriented Programming (OOP) OOP Definitions Imagine: You and your programming team have written
More informationSpring 2003 Instructor: Dr. Shahadat Hossain. Administrative Matters Course Information Introduction to Programming Techniques
1 CPSC2620 Advanced Programming Spring 2003 Instructor: Dr. Shahadat Hossain 2 Today s Agenda Administrative Matters Course Information Introduction to Programming Techniques 3 Course Assessment Lectures:
More informationDesign Patterns (Composite)
CS 247: Software Engineering Principles Design Patterns (Composite) Reading: Freeman, Robson, Bates, Sierra, Head First Design Patterns, O'Reilly Media, Inc. 2004 Ch 9: Composite and Iterator Patterns
More informationConceptual Data Models for Database Design
Conceptual Data Models for Database Design Entity Relationship (ER) Model The most popular high-level conceptual data model is the ER model. It is frequently used for the conceptual design of database
More informationOnline Registration. CAPP courses are actual UW Oshkosh college courses!
Online Registration By completing this process, you will be enrolling in these courses for college credit Grades are final and permanent on transcript As a UW Oshkosh student you must follow our policies,
More informationA Previous CS 310 Final Exam
A Previous CS 310 Final Exam July 20, 2004 Print Your Name: Read the following now. You have 100 minutes to work on 9 questions, totaling 200 points. To ensure partial credit, show all your work! Write
More informationCOMP-202: Foundations of Programming. Lecture 9: Classes and Objects Sandeep Manjanna, Summer 2015
COMP-202: Foundations of Programming Lecture 9: Classes and Objects Sandeep Manjanna, Summer 2015 Announcements Assignment 3: Due on 14 th of June at 11:30 pm. Small Software Glitch Costing Huge The spacecraft
More informationVI. INHERITANCE AND DERIVED CLASSES
VI. INHERITANCE AND DERIVED CLASSES VI.1 General notions The notion of inheritance enables to build a hierarchy of reusable software components. http://younginc.site11.com/source/5895/fos0019.html The
More informationCMPT 354: Database System I. Lecture 3. SQL Basics
CMPT 354: Database System I Lecture 3. SQL Basics 1 Announcements! About Piazza 97 enrolled (as of today) Posts are anonymous to classmates You should have started doing A1 Please come to office hours
More informationOrdering Instructions for Transcripts on Demand by SCRIP SAFE System for the University of New Orleans
Ordering Instructions for Transcripts on Demand by SCRIP SAFE System for the University of New Orleans Instructions for Requesting a Copy of your Academic Transcripts All students former, current and/or
More informationIntroduction to OOP. Procedural Programming sequence of statements to solve a problem.
Introduction to OOP C++ - hybrid language improved and extended standard C (procedural language) by adding constructs and syntax for use as an object oriented language. Object-Oriented and Procedural Programming
More informationOrder a Paper Transcript
Order a Paper Transcript Transcript requests will not be processed for those with holds for financial or other obligations to the University. All University holds must be cleared before requesting a transcript.
More informationObject-Oriented Programming. Lecture 4 Dr Piotr Cybula
Object-Oriented Programming Lecture 4 Dr Piotr Cybula Inheritance enrichment of existing classes with additional functionality ability of modifying the action of methods without
More informationClasses in C++98 and C++11
Classes in C++98 and C++11 January 10, 2018 Brian A. Malloy Slide 1 of 38 1. When we refer to C++98, we are referring to C++98 and C++03, since they differ only slightly. C++98 contained 3 types of constructors,
More informationProcess Document Viewing Customer Accounts
Date Modified 6/17/2008 Concept The Student Financials Customer Accounts page provides access to financial and scholastic data about a student. Charges, Payments, Anticipated Financial Aid, Payment Plan,
More informationCMPE/SE 135 Object-Oriented Analysis and Design
Course and Contact Information San José State University Department of Computer Engineering CMPE/SE 135 Object-Oriented Analysis and Design Instructor: Ron Mak Office Location: ENG 250 Email: ron.mak@sjsu.edu
More informationCoSci 440 SYLLABUS Programming in C++ INSTRUCTOR Mari Rettke cell SECTION : and 13345
CoSci 440 SYLLABUS Programming in C++ INSTRUCTOR Mari Rettke samusher@aol.com 818.470.8419 - cell SECTION : 13327 and 13345 Course Description Covers C++ language and object-oriented programming paradigm.
More informationCSCI-1200 Data Structures Spring 2018 Lecture 15 Associative Containers (Maps), Part 2
CSCI-1200 Data Structures Spring 2018 Lecture 15 Associative Containers (Maps), Part 2 Review of Lecture 14 Maps are associations between keys and values. Maps have fast insert, access and remove operations:
More informationMy Lakeland Student Guide
My Lakeland Student Guide My Lakeland is your connection to your class schedule, your grades, your student account and your personal contact information. Known in technical terms as a student self-service
More informationMidterm Exam #2 Spring (1:00-3:00pm, Friday, March 15)
Print Your Name: Signature: USC email address: CSCI 101L Fundamentals of Computer Programming Midterm Exam #2 Spring 2013 (1:00-3:00pm, Friday, March 15) Instructor: Prof Tejada Problem #1 (20 points):
More informationObject-Oriented Programming. Lecture 2 Dr Piotr Cybula
Object-Oriented Programming Lecture 2 Dr Piotr Cybula Encapsulation : data protection code safety and independence better team support with the code separation without «giving
More informationTHE NAME OF THE CONSTRUCTOR AND DESTRUCTOR(HAVING (~) BEFORE ITS NAME) FUNCTION MUST BE SAME AS THE NAME OF THE CLASS IN WHICH THEY ARE DECLARED.
Constructor and Destructor Member Functions Constructor: - Constructor function gets invoked automatically when an object of a class is constructed (declared). Destructor:- A destructor is a automatically
More informationCLASSES AND OBJECTS IN JAVA
Lesson 8 CLASSES AND OBJECTS IN JAVA (1) Which of the following defines attributes and methods? (a) Class (b) Object (c) Function (d) Variable (2) Which of the following keyword is used to declare Class
More informationCome and join us at WebLyceum
Come and join us at WebLyceum For Past Papers, Quiz, Assignments, GDBs, Video Lectures etc Go to http://www.weblyceum.com and click Register In Case of any Problem Contact Administrators Rana Muhammad
More informationOverview. Guide for the Authorized User
Overview This guide demonstrates how to view your student s account balance and make payments for your student as an Authorized User. Note: Your student must first login to MySJSU and set up an authorized
More informationYou can view your grades via the Student Homepage of icampus. From the left navigation under the Quicklinks section, click on the check grades link.
You can view your grades via the Student Homepage of icampus. From the left navigation under the Quicklinks section, click on the check grades link. You can also access your grades through the Academic
More informationcd h: mkdir -p CS101 cd CS101 curl -O unzip zipfile cd CS101_Exam4
CS 101, Spring 2013 May 2nd Exam 4 Note: Make sure your programs produce the output in exactly the format described, including capitalization and punctuation. You may not receive credit for programs that
More informationCSCI 101L - Data Structures. Practice problems for Final Exam. Instructor: Prof Tejada
CSCI 101L - Data Structures Practice problems for Final Exam Instructor: Prof Tejada 1 Problem 1. Debug this code Given the following code to increase the value of a variable: void Increment(int x) { x
More informationCS111: PROGRAMMING LANGUAGE II. Lecture 1: Introduction to classes
CS111: PROGRAMMING LANGUAGE II Lecture 1: Introduction to classes Lecture Contents 2 What is a class? Encapsulation Class basics: Data Methods Objects Defining and using a class In Java 3 Java is an object-oriented
More informationMULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR
STUDENT IDENTIFICATION NO MULTIMEDIA COLLEGE JALAN GURNEY KIRI 54100 KUALA LUMPUR FIFTH SEMESTER FINAL EXAMINATION, 2014/2015 SESSION PSD2023 ALGORITHM & DATA STRUCTURE DSEW-E-F-2/13 25 MAY 2015 9.00 AM
More informationUML Class Diagrams Revisited
9/25/2003 1 UML Class diagrams Organizing attributes and operations Class relationships Association Aggregation/Composition Multiplicity Dependencies 9/25/2003 2 UML Class Diagrams Revisited In the analysis
More informationHOW TO COMPLETE THE ONLINE SCHOLARSHIP APPLICATION
Doyon Foundation ONLINE SCHOLARSHIP APPLICATION INSTRUCTIONS HOW TO COMPLETE THE ONLINE SCHOLARSHIP APPLICATION We are aware some questions listed below were previously requested, however there is no way
More informationCS304 Object Oriented Programming
1 CS304 Object Oriented Programming 1. Which of the following is the way to extract common behaviour and attributes from the given classes and make a separate class of those common behaviours and attributes?
More informationHow to apply to take IU courses through ACP. Application Overview. IU Bloomington Application Deadline: September 12, 5 PM EDT
How to apply to take IU courses through ACP Application Overview IU Bloomington Application Deadline: September 12, 5 PM EDT Taking an IU course through ACP at your school this fall involves four steps:
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationObject-oriented basics. Object Class vs object Inheritance Overloading Interface
Object-oriented basics Object Class vs object Inheritance Overloading Interface 1 The object concept Object Encapsulation abstraction Entity with state and behaviour state -> variables behaviour -> methods
More informationIntroduction to SQL Part 1 By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford)
Introduction to SQL Part 1 By Michael Hahsler based on slides for CS145 Introduction to Databases (Stanford) Lecture 2 Lecture Overview 1. SQL introduction & schema definitions 2. Basic single-table queries
More informationClasses and Data Abstraction. Topic 5
Classes and Data Abstraction Topic 5 Introduction Object-oriented programming (OOP) Encapsulates data (attributes) and functions (behavior) into packages called classes The data and functions of a class
More informationWhat does it mean by information hiding? What are the advantages of it? {5 Marks}
SECTION ONE (COMPULSORY) Question #1 [30 Marks] a) Describe the main characteristics of object-oriented programming. {5 Marks Encapsulation the ability to define a new type and a set of operations on that
More informationProcessing Transcripts in Batch (End of Day)
Enterprise Information Systems Financial Management + Human Resources + Student Administration Processing Transcripts in Batch (End of Day) Business Process Guide Updates Date Action Page(s) 07/20/2004
More informationCS445 Week 9: Lecture
CS445 Week 9: Lecture Objectives: To discuss the solution of the midterm and answer any doubts about grading issues. Also, during the discussion, refresh the topics from the first part of the course. Reading
More information1 Inheritance (8 minutes, 9 points)
Name: Career Account ID: Recitation#: 1 CS180 Spring 2011 Exam 2, 6 April, 2011 Prof. Chris Clifton Turn Off Your Cell Phone. Use of any electronic device during the test is prohibited. Time will be tight.
More informationI BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination. June, 2015 BCS-031 : PROGRAMMING IN C ++
No. of Printed Pages : 3 I BCS-031 BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination 05723. June, 2015 BCS-031 : PROGRAMMING IN C ++ Time : 3 hours Maximum Marks : 100 (Weightage 75%)
More informationLecture 36: Cloning. Last time: Today: 1. Object 2. Polymorphism and abstract methods 3. Upcasting / downcasting
Lecture 36: Cloning Last time: 1. Object 2. Polymorphism and abstract methods 3. Upcasting / downcasting Today: 1. Project #7 assigned 2. equals reconsidered 3. Copying and cloning 4. Composition 11/27/2006
More informationCS11 Intro C++ Spring 2018 Lecture 1
CS11 Intro C++ Spring 2018 Lecture 1 Welcome to CS11 Intro C++! An introduction to the C++ programming language and tools Prerequisites: CS11 C track, or equivalent experience with a curly-brace language,
More informationME 172. Lecture 2. Data Types and Modifier 3/7/2011. variables scanf() printf() Basic data types are. Modifiers. char int float double
ME 172 Lecture 2 variables scanf() printf() 07/03/2011 ME 172 1 Data Types and Modifier Basic data types are char int float double Modifiers signed unsigned short Long 07/03/2011 ME 172 2 1 Data Types
More informationObject Oriented Design
Object Oriented Design Lecture 3: Introduction to C++ (Continue) Examples using declarations that eliminate the need to repeat the std:: prefix 1 Examples using namespace std; enables a program to use
More informationComputer Programming
Computer Programming Dr. Deepak B Phatak Dr. Supratik Chakraborty Department of Computer Science and Engineering Session: Inheritance in C++ Dr. Deepak B. Phatak & Dr. Supratik Chakraborty, 1 Overview
More informationPrelim 1. CS 2110, 13 March 2018, 5:30 PM Total Question Name Short answer
Prelim 1 CS 2110, 13 March 2018, 5:30 PM 1 2 3 4 5 6 Total Question Name Short answer Exception handling Recursion OO Loop invariants Max 1 30 11 14 30 14 100 Score Grader The exam is closed book and closed
More informationOOPs Concepts. 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8.
OOPs Concepts 1. Data Hiding 2. Encapsulation 3. Abstraction 4. Is-A Relationship 5. Method Signature 6. Polymorphism 7. Constructors 8. Type Casting Let us discuss them in detail: 1. Data Hiding: Every
More informationLecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University
Lecture 3 COMP1006/1406 (the Java course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments 1 (graded) & 2 3 (available now) & 4 (tomorrow) a quick look back primitive data types
More informationCGS 2405 Advanced Programming with C++ Course Justification
Course Justification This course is the second C++ computer programming course in the Computer Science Associate in Arts degree program. This course is required for an Associate in Arts Computer Science
More informationLAB 4.1 Relational Operators and the if Statement
LAB 4.1 Relational Operators and the if Statement // This program tests whether or not an initialized value of num2 // is equal to a value of num1 input by the user. int main( ) int num1, // num1 is not
More informationComplex data types Structures Defined types Structures and functions Structures and pointers (Very) brief introduction to the STL
Complex data types Structures Defined types Structures and functions Structures and pointers (Very) brief introduction to the STL Many programs require complex data to be represented That cannot easily
More informationCOMS W3101 Programming Language: C++ (Fall 2016) Ramana Isukapalli
COMS W3101 Programming Language: C++ (Fall 2016) ramana@cs.columbia.edu Lecture-2 Overview of C C++ Functions Structures Pointers Design, difference with C Concepts of Object oriented Programming Concept
More informationPaytm Programming Sample paper: 1) A copy constructor is called. a. when an object is returned by value
Paytm Programming Sample paper: 1) A copy constructor is called a. when an object is returned by value b. when an object is passed by value as an argument c. when compiler generates a temporary object
More information2017 SPRING INTERNSHIP PROGRAM OPPORTUNITY
2017 SPRING INTERNSHIP PROGRAM OPPORTUNITY The New Jersey Office of Homeland Security and Preparedness () offers internships to a select group of applicants. These are part-time, unpaid internships for
More information* 1. By typing my name below I affirm I am the Kiwanis International Foundation district chair for my district.
Pre-qualifiying question * 1. By typing my name below I affirm I am the Kiwanis International Foundation district chair for my district. Pre-qualifying question * 2. I certify that I read the program guidelines
More informationMidterm Examination # 2 Wednesday, March 19, Duration of examination: 75 minutes STUDENT NAME: STUDENT ID NUMBER:
Page 1 of 7 School of Computer Science 60-141-01 Introduction to Algorithms and Programming Winter 2014 Midterm Examination # 2 Wednesday, March 19, 2014 ANSWERS Duration of examination: 75 minutes STUDENT
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 03: Creating Classes MOUNA KACEM mouna@cs.wisc.edu Spring 2019 Creating Classes 2 Constructors and Object Initialization Static versus non-static fields/methods Encapsulation
More informationMidterm Examination # 2 Wednesday, March 18, Duration of examination: 75 minutes STUDENT NAME: STUDENT ID NUMBER:
Page 1 of 8 School of Computer Science 60-141-01 Introduction to Algorithms and Programming Winter 2015 Midterm Examination # 2 Wednesday, March 18, 2015 ANSWERS Duration of examination: 75 minutes STUDENT
More informationAccounts Receivable Customer
Accounts Receivable Customer Contents Overview... 1 Document Layout... 2 General Information Tab... 3 Corporate Information Tab... 3 Contact Information Tab... 4 Addresses Tab... 4 Overview The Customer
More informationCOMS W3101 Programming Language: C++ (Fall 2015) Ramana Isukapalli
COMS W3101 Programming Language: C++ (Fall 2015) ramana@cs.columbia.edu Lecture-3 Constructor and destructor review Data and Member functions review Data encapsulation public, private and protected members
More informationParent Instructions for Registration in Genius Course Requests, Drop Requests & Transcripts
Parent Instructions for Registration in Genius Course Requests, Drop Requests & Transcripts To begin, log in to the NSO Genius page: http://mn.geniussis.com/publicwelcome.aspx?id=2 There is also a link
More informationObject Oriented Methods with UML. Introduction to Design Patterns- Lecture 8
Object Oriented Methods with UML Introduction to Design Patterns- Lecture 8 Topics(03/05/16) Design Patterns Design Pattern In software engineering, a design pattern is a general repeatable solution to
More informationAggregation. Introduction to Computer Science I. Overview (1): Overview (2): CSE 1020 Summer Bill Kapralos. Bill Kapralos.
Aggregation Thursday, July 6 2006 CSE 1020, Summer 2006, Overview (1): Before We Begin Some administrative details Some questions to consider Aggregation Overview / Introduction The aggregate s constructor
More informationObject-Oriented Programming in Java. Topic : Objects and Classes (cont) Object Oriented Design
Electrical and Computer Engineering Object-Oriented in Java Topic : Objects and Classes (cont) Object Oriented Maj Joel Young Joel.Young@afit.edu 11-Sep-03 Maj Joel Young Using Class Instances Accessing
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 03: Creating Classes MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Creating Classes 2 Constructors and Object Initialization Static versus non-static fields/methods Encapsulation
More informationEntity vs. Value, Modules, Hidden Implementation, Interface Specification
Entity vs. Value, Modules, Hidden Implementation, Interface Specification CS 247 University of Waterloo cs247@uwaterloo.ca May 19, 2017 CS 247 (UW) Tutorial 3 May 19, 2017 1 / 24 Overview 1 Move Constructors,
More informationCIS3023: Programming Fundamentals for CIS Majors II Summer 2010
CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Objects and Classes (contd.) Course Lecture Slides 19 May 2010 Ganesh Viswanathan Objects and Classes Credits: Adapted from CIS3023 lecture
More informationC How to Program, 6/e by Pearson Education, Inc. All Rights Reserved. 1
C How to Program, 6/e 1 Structures : Aggregate data types are built using elements of other types struct Time { int hour; int minute; Members of the same structure must have unique names. Two different
More information