Classes & Objects CSCE 121 J. Michael Moore.

Slides:



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

Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Object-Oriented programming in C++ Classes as units of encapsulation Information Hiding Inheritance polymorphism and dynamic dispatching Storage management.
4. Object-Oriented Programming Procedural programming Structs and objects Object-oriented programming Concepts and terminology Related keywords.
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
Computer Science and Engineering College of Engineering The Ohio State University Classes and Objects: Members, Visibility The credit for these slides.
CHAPTER 13 Object Oriented Programming. Objectives  Design class definitions  Implement data hiding and encapsulation  Use accessor and mutator methods.
Visual C++ Programming: Concepts and Projects Chapter 13A: Object-Oriented Programming (Concepts)
1 Classes Overview l Classes as Types l Declaring Instance Variables l Implementing Methods l Constructors l Accessor and Mutator Methods.
Object Oriented Programming.  OOP Basic Principles  C++ Classes  September 2004  John Edgar 22.
Lecture 9 Concepts of Programming Languages
CS 2511 Fall Features of Object Oriented Technology  Abstraction Abstract class Interfaces  Encapsulation Access Specifiers Data Hiding  Inheritance.
1 Review: Two Programming Paradigms Structural (Procedural) Object-Oriented PROGRAM PROGRAM FUNCTION OBJECT Operations Data OBJECT Operations Data OBJECT.
Classes in C++ Bryce Boe 2012/08/15 CS32, Summer 2012 B.
Classes Mark Hennessy Dept. Computer Science NUI Maynooth C++ Workshop 18 th – 22 nd Spetember 2006.
Classes and Class Members Chapter 3. 3 Public Interface Contract between class and its clients to fulfill certain responsibilities The client is an object.
An Introduction to Java Chapter 11 Object-Oriented Application Development: Part I.
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.
1 Chapter 8 – Classes and Object: A Deeper Look Outline 1 Introduction 2 Implementing a Time Abstract Data Type with a Class 3 Class Scope 4 Controlling.
P Chapter 2 introduces Object Oriented Programming. p OOP is a relatively new approach to programming which supports the creation of new data types and.
JAVA Classes Review. Definitions Class – a description of the attributes and behavior of a set of computational objects Constructor – a method that is.
Computer Science 111 Fundamentals of Computer Programming I Working with our own classes.
Chapter 3 (B) 3.5 – 3.7.  Variables declared in a function definition’s body are known as local variables and can be used only from the line of their.
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.
OOP with Java, David J. Barnes/Eric Jul Defining Classes1 Object State and Complexity Objects maintain a state. State is represented by a set of attributes.
Liang, Introduction to C++ Programming, (c) 2007 Pearson Education, Inc. All rights reserved X 1 Chapter 9 Objects and Classes.
Chapter 11 An introduction to object-oriented design.
Defining Classes I Part B. Information hiding & encapsulation separate how to use the class from the implementation details separate how to use the class.
1 Introduction to Object Oriented Programming Chapter 10.
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 13: Introduction to Classes.
OOP Basics Classes & Methods (c) IDMS/SQL News
Chapter 11 An introduction to object-oriented design.
Comp1004: Building Better Objects II Encapsulation and Constructors.
Written by: Dr. JJ Shepherd
Procedural and Object-Oriented Programming
Object-Oriented Programming Concepts
Classes C++ representation of an object
Classes and OOP.
Topics Procedural and Object-Oriented Programming Classes
Review: Two Programming Paradigms
Object Oriented Concepts -I
Introduction to Classes
Creating Your OwnClasses
Anatomy of a class Part I
(5 - 1) Object-Oriented Programming (OOP) and C++
Classes In C#.
Lecture 9 Concepts of Programming Languages
Modeling Classes with UML
Introduction to Classes
Compound Data CSCE 121 J. Michael Moore.
IFS410: Advanced Analysis and Design
Classes & Objects: Examples
Encapsulation and Constructors
Chapter 9 Objects and Classes
(5 - 1) Object-Oriented Programming (OOP) and C++
COP 3330 Object-oriented Programming in C++
CIS16 Application Development and Programming using Visual Basic.net
Object-Oriented Programming
Classes C++ representation of an object
Dr. R Z Khan Handout-3 Classes
CPS120: Introduction to Computer Science
Data Structures and ADTs
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Anatomy of a class Part I
CSG2H3 Object Oriented Programming
Lecture 9 Concepts of Programming Languages
Presentation transcript:

Classes & Objects CSCE 121 J. Michael Moore

Datatypes Simple Compound int, double, bool, etc. Homogeneous Heterogeneous Array Vector struct Class

Procedural Programming So far the focus is on the steps, actions, and functions. Data is subordinate to functions. Object Oriented Programming Focus is on the data. Functions are subordinate to the data.

Object Oriented Model real world objects (mostly) Grouping Related data (Attributes) In C++ called data members Related actions (Methods) In C++ called member functions Communication occurs through messages Object is spoken to by calling a method on it.

Concept of Class Class is a generic description Think blueprint Object is an instance of the class Think the blue house on the corner And the red one on the next block And the green one next door I.e. there are multiple instances of a single class

Information Hiding / Encapsulation Visibility Creating for others to use (e.g. make a Library) Information Hiding / Encapsulation Public Want some things visible to others What Tend to be methods / member functions Private Want some things hidden from others. How Might Change Tend to be data members / attributes

Interface Public Attributes Methods Private Methods Attributes Call with parameters Private Helper Functions Rare Get / Set values and enforce rules. Accessor & Mutator methods (getters/setters) Constructor (initializes object)

C++ Note Struct and class are almost interchangeable in C++ Struct was used in C for heterogeneous data Class adopted into C++ (label was common in other languages) Class concept groups not only heterogeneous data, but the methods that act on them. This capability was given to structs as well. Differ in default visibility Class is private by default Struct is public by default