OOPDA Review. Terminology class-A template defining state and behavior class-A template defining state and behavior object-An instance of a class object-An.

Slides:



Advertisements
Similar presentations
Class Scope class Student { private: string id; string firstName, lastName; float gpa; public: void Read() { cin >> id >> firstName >> lastName >> gpa;
Advertisements

Introduction to Programming Lecture 39. Copy Constructor.
Using Classes to Store Data Computer Science 2 Gerb.
C++ Classes & Data Abstraction
Reusable Classes.  Motivation: Write less code!
Copyright 2006 by Pearson Education 1 Building Java Programs Chapter 8: Classes and Objects.
Lecture 8: Objects and Classes, cont’d discuss hw2 assign h3 Review the main points of objects/classes This Pass-by-value A new example: our Date class.
Encapsulation, Inheritance & Interfaces CSE 115 Spring 2006 February 27, March 1 & 3, 2006.
Class template Describing a generic class Instantiating classes that are type- specific version of this generic class Also are called parameterized types.
Liang Chapter 6 Variable scope and the keyword this.
What is a class? a class definition is a blueprint to build objects its like you use the blueprint for a house to build many houses in the same way you.
Vladimir Misic: Scope and Lifetime1 Scope And Lifetime Material Borrowed from Nan Schaller.
Inheritance Review/Recap. ClassA extends ClassB ClassA now inherits (can access and use) all public and protected elements of ClassB We can expect the.
1 More on Classes Overview l Overloading l The this keyword l The toString method l The equals method.
UML Basics & Access Modifier
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
BPJ444: Business Programming Using Java Classes and Objects Tim McKenna
Static Keyword. What is static The static keyword is used when a member variable of a class has to be shared between all the instances of the class. All.
Copyright 2008 by Pearson Education Building Java Programs Chapter 8 Lecture 8-3: Encapsulation, this reading: self-checks: #13-17 exercises:
Tuc Goodwin  Object and Component-Oriented Programming  Classes in C#  Scope and Accessibility  Methods and Properties  Nested.
1 Object state: fields. Fields field: A variable inside an object that represents part of its internal state.  Each object will have its own copy of.
Chapter 10 Defining Classes. The Internal Structure of Classes and Objects Object – collection of data and operations, in which the data can be accessed.
Classes. Student class We are tasked with creating a class for objects that store data about students. We first want to consider what is needed for the.
Chapter 3 Introduction to Classes and Objects Definitions Examples.
Review Creating Objects Pepper many references from rial/java/objects/object.html
Copyright 2006 by Pearson Education 1 Building Java Programs Chapter 8: Classes and Objects.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
Constructor OverloadingtMyn1 Constructor Overloading One context in which you will regularly need to use overloading is when you write constructors for.
AP Java Ch. 4 Review Question 1  Java methods can return only primitive types (int, double, boolean, etc).
Methods.
Structured Programming Dr. Atif Alhejali Lecture 4 Modifiers Parameters passing 1Structured Programming.
Lecture 3: More on Classes Textbook: Chapter 2 Recap: –Classes vs. Objects –Q: What comes first a class or an object? –Q: Do we need a class to create.
Class Everything in Java is in a class. The class has a constructor that creates the object. If you do not supply a constructor Java will create a default.
Basic Class Structure. Class vs. Object class - a template for building an object –defines the instance data that the object will hold –defines instance.
JAVA ACCESS MODIFIERS. Access Modifiers Access modifiers control which classes may use a feature. A classes features are: - The class itself - Its member.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
Java 5 Class Anatomy. User Defined Classes To this point we’ve been using classes that have been defined in the Java standard class library. Creating.
2-Oct-16 Basic Object-Oriented Concepts. 2 Concept: An object has behaviors In old style programming, you had: data, which was completely passive functions,
Re-Intro to Object Oriented Programming
GC211 Data structure Lecture 3 Sara Alhajjam.
Objects as a programming concept
Introduction to Programming G50PRO University of Nottingham Unit 9 : Classes and objects Paul Tennent
Examples of Classes & Objects
AKA the birth, life, and death of variables.
CSE 8A Lecture 17 Reading for next class: None (interm exam 4)
Intro To Classes Review
Creating Your OwnClasses
Instance Method Review - CIS 1068 Program Design and Abstraction
CSC240 Computer Science III
An Introduction to Java – Part II
Overloading and Overriding
Building Java Programs
Simple Classes in C# CSCI 293 September 12, 2005.
Classes & Objects: Examples
String Methods: length substring
CLASS DEFINITION (FIELDS)
Assignment 7 User Defined Classes Part 2
Building Java Programs
CS2011 Introduction to Programming I Objects and Classes
Class Everything if Java is in a class. The class has a constructor that creates the object. public class ClassName private Field data (instance variables)
Which best describes the relationship between classes and objects?
Building Java Programs
JAVA CLASSES.
Handout-4b More on Classes
Instance Method – CSC142 Computer Science II
Java Programming Language
Welcome back to Software Development!
Class: Special Topics Overloading (methods) Copy Constructors
Methods (a.k.a functions)
Chapter 5 Classes.
Presentation transcript:

OOPDA Review

Terminology class-A template defining state and behavior class-A template defining state and behavior object-An instance of a class object-An instance of a class variable-Storage for data variable-Storage for data field- Storage for an object’s data (i.e. an instance variable) field- Storage for an object’s data (i.e. an instance variable) static field-Storage for a class’s data (i.e. a class variable) static field-Storage for a class’s data (i.e. a class variable) method-Behavior of an object (i.e. an instance method) method-Behavior of an object (i.e. an instance method) static method -Behavior of a class (i.e. a class method) static method -Behavior of a class (i.e. a class method) constructor -Method used to initialize an object constructor -Method used to initialize an object parameter -Variable defined in a method signature parameter -Variable defined in a method signature local variable -Variable defined inside a method. local variable -Variable defined inside a method.

Terminology public class { private int ; public String ; float ; public (int, float ) { this.x = x; y = w; s = new String (“hi”); } public void aMethod (int x) { String ; print ( ); } class fields constructor method parameters local variable signature MyClass x w public void aMethod (int x) x s y field s s this.s parameter x this.x

Terminology this this A reference to the object ‘receiving’ the method call. A reference to the object ‘receiving’ the method call. (See demo) (See demo)