Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.

Slides:



Advertisements
Similar presentations
Chapter 13 – Introduction to Classes
Advertisements

Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2012 Pearson Education, Inc. Chapter 14: More About Classes.
Lesson 14 Classes, Continued CS1 Lesson More Classes1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 9- 1.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Java: Early Objects Third Edition by Tony Gaddis Chapter.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 11 Object, Object- Relational, and XML: Concepts, Models, Languages,
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
1 Fall 2007ACS-1903 Chapter 6: Classes Classes and Objects Instance Fields and Methods Constructors Overloading of Methods and Constructors Scope of Instance.
Programming With Java ICS201 University Of Hail1 Chapter 12 UML and Patterns.
Chapter 6: A First Look at Classes
UML Basics & Access Modifier
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
A First Look At Classes Chapter 6. Procedural Programming In procedural- programming all the program functionality is written in a few modules of code.
Starting Out With Java 5 (Control Structures to Objects) Chapter 6 By Tony Gaddis Copyright © 2005 Pearson Addison-Wesley. All rights reserved.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Java: From Control Structures through Objects Third Edition.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Java: Early Objects Third Edition by Tony Gaddis Chapter.
Starting Out with Java: From Control Structures through Objects.
I NTRODUCTION TO PROGRAMMING Starting Out with Java: From Control Structures through Objects.
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13: Introduction to Classes.
Chapter 13. Procedural programming vs OOP  Procedural programming focuses on accomplishing tasks (“verbs” are important).  Object-oriented programming.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Chapter 10 Classes and Objects: A Deeper Look Visual C# 2010 for Programmers © by Pearson Education, Inc. All Rights Reserved.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 102 Computer Programming II (Lab:
What you need to know about UML Not much but you need to know something.
CSci 162 Lecture 10 Martin van Bommel. Procedures vs Objects Procedural Programming –Centered on the procedures or actions that take place in a program.
Page 4.1 – Autumn 2010Steffen Vissing Andersen SDJ I1, Autumn 2010 Agenda – Session 4 – 7. September 2009 Java fundamentals, checkpoint from chapter 2.
Some odds and ends about Classes and Objects. 6-2 Object-Oriented Programming Object Data (Fields) Methods That Operate on the Data.
© 2010 Pearson Addison-Wesley. All rights reserved. 6-1 Chapter Topics Chapter 6 discusses the following main topics: –Classes and Objects –Instance Fields.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 14: More About Classes.
Lecture 19: Introduction to Classes Professor: Dr. Miguel Alonso Jr. Fall 2008 CGS2423/COP1220.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 3 A First Look at Classes and Objects.
Separating Class Specification tMyn1 Separating Class Specification from Implementation Usually class declarations are stored in their own header files.
Starting Out With Java 5 Control Structures to Objects By Tony Gaddis Copyright © 2005, 2005 Pearson Addison-Wesley. All rights reserved. Chapter 6 Slide.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 13: Introduction to Classes.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design Second Edition by Tony Gaddis.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley The Unified Modeling Language
CSCI/CMPE 4341 Topic: Programming in Python Chapter 7: Introduction to Object- Oriented Programming in Python – Exercises Xiang Lian The University of.
CS16: UML’s Unified Modeling Language. UML Class Diagram A UML class diagram is a graphical tool that can aid in the design of a class. The diagram has.
Introduction to Constructors Lecture # 4. Copyright © 2011 Pearson Education, Inc. 3-2 Arguments Passed By Value In Java, all arguments to a method are.
CS 350 – Software Design UML – The Unified Modeling Language – Chapter 2 The Unified Modeling Language is a visual language used to create models of programs.
Chapter 6 A First Look at Classes. 2 Contents 1. Classes and objects 2. Instance Fields and Methods 3. Constructors 4. Overloading Methods and Constructors.
COP 3330 Notes 4/13. Today’s Topics UML Class Diagrams.
Copyright © 2011 Pearson Education, Inc. Starting Out with Java: Early Objects Fourth Edition by Tony Gaddis Chapter 3: A First Look at Classes and Objects.
Chapter 6 A First Look at Classes. 2 Contents 1. Classes and objects 2. Instance Fields and Methods 3. Constructors 4. Overloading Methods and Constructors.
Pointer to an Object Can define a pointer to an object:
Procedural and Object-Oriented Programming
Advanced Program Design with C++
Default Constructors A default constructor is a constructor that takes no arguments. If you write a class with no constructor at all, C++ will write a.
Chapter 3 Classes & Objects
A first Look at Classes.
classes and objects review
Introduction to Classes
Chapter 6: A First Look at Classes
Introduction to Classes
Intro to UML Edited from presentation found at:
OBJECT-ORIENTED PROGRAMMING
Today’s topics UML Diagramming review of terms
Lial/Hungerford/Holcomb: Mathematics with Applications 10e
Introduction to Classes and Objects
Chapter 11 Principles of Experimental Design.
Section 10.5 The Dot Product
Lecture 8 Object Oriented Programming (OOP)
Presentation transcript:

Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes

Copyright © 2012 Pearson Education, Inc The Unified Modeling Language

Copyright © 2012 Pearson Education, Inc. The Unified Modeling Language UML stands for Unified Modeling Language. The UML provides a set of standard diagrams for graphically depicting object- oriented systems

Copyright © 2012 Pearson Education, Inc. UML Class Diagram A UML diagram for a class has three main sections.

Copyright © 2012 Pearson Education, Inc. Example: A Rectangle Class class Rectangle { private: double width; double length; public: bool setWidth(double); bool setLength(double); double getWidth() const; double getLength() const; double getArea() const; };

Copyright © 2012 Pearson Education, Inc. UML Access Specification Notation In UML you indicate a private member with a minus (-) and a public member with a plus(+). These member variables are private. These member functions are public.

Copyright © 2012 Pearson Education, Inc. UML Data Type Notation To indicate the data type of a member variable, place a colon followed by the name of the data type after the name of the variable. - width : double - length : double

Copyright © 2012 Pearson Education, Inc. UML Parameter Type Notation To indicate the data type of a function’s parameter variable, place a colon followed by the name of the data type after the name of the variable. + setWidth(w : double)

Copyright © 2012 Pearson Education, Inc. UML Function Return Type Notation To indicate the data type of a function’s return value, place a colon followed by the name of the data type after the function’s parameter list. + setWidth(w : double) : void

Copyright © 2012 Pearson Education, Inc. The Rectangle Class

Copyright © 2012 Pearson Education, Inc. Showing Constructors and Destructors Constructors Destructor No return type listed for constructors or destructors