Chapter 12. OOP: Creating Object-Oriented Programs The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill

Size: px
Start display at page:

Download "Chapter 12. OOP: Creating Object-Oriented Programs The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill"

Transcription

1 Chapter 12 OOP: Creating Object-Oriented Programs McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved.

2 Chapter Objectives - 1 Use object-oriented terminology correctly Create a two-tier application that separates the user interface from the business logic Differentiate between a class and an object Create a class that has properties and methods Declare object variables and assign values to the properties with a constructor or property methods McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. 12-2

3 Chapter Objectives - 2 Instantiate an object in a project using your class Differentiate between static members and instance members Understand the purpose of the constructor and destructor methods Inherit a new class from your own class Use visual inheritance by basing a form on another form McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. 12-3

4 Object-Oriented Programming OOP is currently the most accepted style of programming C#, Java, and SmallTalk were designed to be object oriented (OO) from their inception Visual Basic and C++ have been modified to accommodate OOP As projects become more complex, using objects becomes increasingly important McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. 12-4

5 Objects - 1 C# allows the creation of new object types by creating a class Classes may have properties, methods, and events Many built-in choices for objects, such as all tools in the toolbox The tool represents the class, such as button The instance that your create from the class is the object, such as exitbutton Defining a class creates a definition of what the object looks like and how it behaves May create as many instances of the class as needed using the new keyword McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. 12-5

6 Objects - 2 Cookie analogy Cookie cutter is the class Cannot eat a cookie cutter Can use a cookie cutter to make cookies Cookie is the object Make a cookie using a cookie cutter Instantiate the cookie class, creating an object of the class Use the same cookie cutter to make various kinds of cookies Characteristics of the cookie, flavor or topping, are the properties of the object Cookie1.Flavor = Lemon ; Cookie1.Topping = Cream Frosting ; McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. 12-6

7 Objects - 3 Eat, Bake, or Crumble are methods Cookie1.Crumble(); Anything the object is told to do is a method Tell the cookie to crumble (method) If an object does an action and needs to inform the user, that is an event The cookie crumbles on its own and informs the user (event) McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. 12-7

8 Object-Oriented Terminology Encapsulation Inheritance Polymorphism Reusable Classes Multitier Applications McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. 12-8

9 Encapsulation Refers to the combination of the characteristics and behaviors of an object One package or capsule that holds the definition of all properties, methods and events Cannot make up new properties or tell the object to do anything it doesn t already know how to do Can implement data hiding An object can expose only those data elements and methods that it wishes to public and private keywords determine access McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. 12-9

10 Inheritance - 1 Ability to create a new class from an existing class Add or modify class variables and methods in a new class that inherits from an existing class An example Each form created inherits from the existing Form class Original class is called base class, superclass, or parent class Inherited class is called subclass, derived class, or child class Inherited classes have an is a relationship with the base class McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

11 Inheritance - 2 Purpose of inheritance is reusability Reuse functionality from one class or object in another similar situation New class created has all characteristics and actions of the base class Additional functionality added to new class Common code placed in base class Create new classes from base class New classes inherit base class methods McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

12 Inheritance - 3 Person class is an example of reusing classes Base class Person Subclasses Employee Customer Student McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

13 Polymorphism Methods that have identical names but different implementations depending on the specific object or arguments Radio buttons, check boxes, and list boxes all have a Select method, which operates appropriately for its class Overloading Several argument lists for calling the method Example: MessageBox.Show method Overriding A method that has the same signature (name and parameter list) as its base class Method in subclass takes precedence, or overrides, the identically named method in the base class McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

14 Reusable Classes Big advantage of OOP over traditional programming is ability to reuse classes A class can be used in multiple projects Each object created from the class has its own properties For any programming situation consider writing a base class that can be used in many projects McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

15 Multitier Applications - 1 Each of the functions in a multitier application can be coded in a separate component and stored and run on different machines Most popular approach is a three-tier application Presentation (user interface), Business (logic) and Data (retrieve and store in database) tiers Goal is to create components that can be combined and replaced If one part of an application needs to change, other components do not need to be replaced McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

16 Multitier Applications - 2 Common implementation of multitier application McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

17 Designing Your Own Class - 1 Analyze the characteristics (variables) and behaviors (methods) needed by a new object Example A form gathers price and quantity of a product Design a class to perform calculation of extended price Price, quantity, and extended price are stored in private variables in the class Variables are accessed through property methods McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

18 Designing Your Own Class - 2 The form instantiates the class Pass the price and quantity to it through property procedures Call a method to calculate the extended price Display the extended price on the form by retrieving it from a property method McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

19 Designing Your Own Class - 3 A presentation tier object and a business tier object The data are entered and displayed in the presentation tier Calculations are performed in the business tier McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

20 Creating Properties in a Class Define private member variables inside your class Stores the values for the properties of the class Declare all variables as private or protected, not public, which violates the rules of encapsulation Protected variables and methods behave as private but are available in classes that inherit from the class Use property set and get methods to pass values between a class and the class where objects of the class are instantiated McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

21 Class Methods Create methods of a new class by coding public methods within the class Methods declared with the private keyword are available only within the class Methods declared with the public keyword are available to external objects created from this class or other classes Methods declared with the protected keyword behave as private within the class and any class that inherits from it McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

22 Constructors and Destructors A constructor is a method that executes automatically when an object is instantiated Has the same name as the class A destructor is a method that executes automatically when an object is destroyed McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

23 Constructor Executes automatically when an instance (object) of the class is created Ideal location for initialization tasks such as setting the initial values of variables and properties Constructor must be public because the objects created must execute this method If no constructor is written for a class, the compiler creates an implicit default constructor with an empty parameter list McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

24 Overloading the Constructor Overloading means that two methods have the same name but a different list of arguments (the signature) Create overloaded methods in a class Give the same name to multiple methods Each with a different argument list An empty constructor public ClothingSale() A constructor that passes arguments to the class public ClothingSale(string productnumberstring, int quantityinteger, decimal discountratedecimal) McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

25 Parameterized Constructor A constructor that requires arguments Allows arguments to be passed when creating a new object from the class Assign incoming values to the properties of the class Assign an argument to the property name, which then uses the set method Validation is often performed in the set methods McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

26 Creating a New Class Step-by-Step Add a new class to a project Choose Project/Add Class In the Add New Item dialog box, select Class Name the class and click Add Define the class properties Declare private class-level variables to hold the property values of the new class Write the property methods with a public get and a private set method Write the constructor Code a method McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

27 Property Methods with Mixed Access Levels Set a property statement as public and then assign a private get or set method public string EmployeeID { get { return employeeidstring; } private set { employeeidstring = value; } } Allows public access to the get method while the set method is private McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

28 Creating a New Object Using a Class - 1 Creating a new class does not create any objects of the class Similar to creating a new tool for the toolbox Generally a two-step operation Declare the variable Instantiate the new object using the new keyword Can declare and instantiate in the same statement ClothingSale aclothingsale = new ClothingSale(); McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

29 Creating a New Object Using a Class - 2 If an object variable is to be used in multiple methods, declare the object at class level Instantiate the object inside of a method at the time the object is needed Use a try/catch if converting and passing values entered by a user Pass values for the arguments at instantiation when using a parameterized constructor McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

30 Single-Step the Execution Quickest and easiest way to debug Place a breakpoint on a line of code Run the program When the program stops at the breakpoint, press F11 repeatedly and watch each step If an error message halts program execution, point to the variable or property names to see their current value McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

31 Instance Variables versus Static Variables Instance variables and properties Separate memory location for each instance of the object Each object created from the class has its own set of properties Also called instance members An instance member has one copy for each instance or object of the class Static variable, property or method Exists, or is available, for all objects of the class Used for a count or total of all objects of the class Also called static members A static member has one copy for all objects of the class Access static members without instantiating an object McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

32 Creating Static Members Use the static keyword to create a static member Make properties for static members read-only Allows values to be retrieved, but not set directly A static keyword on a private class-level variable is required The static keyword on a property method is optional Allows a property to be retrieved without creating an instance of the class McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

33 Destructors Write a destructor to handle processing needed when an object goes out of scope A destructor method has the same name as the class, preceded by a tilde (~) Automatically calls the Object.Finalize method from the base class of the object The programmer has no control over when the destructor is called Handled by the CLR as part of garbage collection Microsoft advises against writing destructors in classes as it has an adverse effect on the performance of the garbage collector McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

34 Garbage Collection Feature of.net Common Language Runtime (CLR), cleans up unused components Periodically checks for unreferenced objects and releases all memory and system resources used by the objects Microsoft recommends depending on garbage collection to release resources rather than writing destructors Don t know exactly when objects will be finalized CLR performs garbage collection on its own schedule McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

35 Inheritance A new class can be based on another class Can inherit from One of the existing.net classes One of your own classes The inheritance clause must follow the class header prior to any comments McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

36 Inheriting Properties and Methods When writing code for a derived class, all public and protected data members and methods of the base class can be referenced Use the protected keyword to declare elements that are accessible only within their own class or any class derived from that class McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

37 Overriding Methods - 1 To override a method in C# Declare the original method (in the base class) with the virtual or abstract keyword Access modifier for the override method must be the same as the base-class method protected virtual decimal calculateextendedprice() protected override decimal calculateextendedprice() McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

38 Overriding Methods - 2 Declaring a method in the base class Use keywords virtual The method has code that can be overridden abstract Designed to be overridden by subclasses and have no implementation of their own Derived class must provide its own code for the method Written strictly for inheritance Cannot instantiate an object from an abstract class override The method is overriding a method in its base class McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

39 Accessing Properties - 1 A derived class can set and retrieve properties of the base class by using the property accessor methods The subclass constructor uses the base statement to call the constructor of the base class Argument values can be passed when the constructor is called McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

40 Accessing Properties - 2 After assigning values to the properties of the base class, refer to them in methods of the derived class Properties must have both a get and a set accessor method Read-only or write-only properties cannot be accessed by name from a derived class McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

41 Creating a Base Class Strictly for Inheritance - 1 Create a base class solely for the purpose of inheritance by two or more similar classes Include the abstract modifier on the class declaration In each method of the base class that must be overridden, include the abstract modifier Method that must be overridden does not contain any code in the base class Must build (compile) the base class before using it for an inherited class McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

42 Creating a Base Class Strictly for Inheritance - 2 Base Class public abstract class BaseClass { public abstract void somemethod() { // No code allowed here. } } Inherited Class public class DerivedClass : BaseClass { public override void somemethod() { // Code goes here. } } McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

43 Inheriting Form Classes - 1 Projects can require several forms May want to use a similar design for all forms Use visual inheritance by designing one form and then inheriting any other forms Design the form to be used as the base class Base class inherits from Form and new forms inherit from the base class McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

44 Inheriting Form Classes - 2 Create the base form and compile the project Select Project/Add Windows Form and type the name of the new form Choose from two ways to define the inherited form class 1. In code, modify the class header public partial class NewForm : BaseForm 2. Select the InheritedForm icon (only available in the Professional Edition) Click the Add button, select from the list of compiled forms in the project that can be used for inheritance McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

45 Inheriting Form Classes - 3 Base Form Inherited Forms Inherited controls (Small arrow in the corner of controls on inherited forms) McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

46 Coding for Events of an Inherited Class Double-clicking a control on an inherited form does not open the event method In the base form s code declare the control s event method as public or protected Recompile the project In the inherited form s code type the code to write an event for the matching control IntelliSense will help with this Declare the event as public or protected, must match base class McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

47 Setting the Startup Form Visual Studio by default begins execution of C# applications with the Program.cs file The first form added to a project is the startup form To change the startup form, modify the Application.Run method in the Program.cs file Application.Run(new MainForm()); McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

48 Managing Multiclass Projects Form classes must be kept in separate files Other classes do not have to be kept in separate files Code multiple classes in one file McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

49 Adding an Existing Class to a Project Two ways to include an existing form or other class in a project 1. Reference the file in its original location 2. Move or copy the file into the project folder (best way) Select Project/Add Existing Item to add the file to the project Or, right-click the project name in Solution Explorer and select from the context menu McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

50 Using the Object Browser - 1 Use this helpful tool to view the names, properties, methods, events, and constants of C# objects, your own objects, and objects available from other applications To display Select View/Object Browser Click the Object Browser toolbar button McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

51 Using the Object Browser - 2 McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

52 Examining C# Classes - 1 Members of System.Windows.Forms.MessageBox Class McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

53 Examining C# Classes - 2 Display the MessageBoxButtons constants McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

54 Examining Your Own Classes McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved

Chapter 12. OOP: Creating Object- Oriented Programs. McGraw-Hill. Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.

Chapter 12. OOP: Creating Object- Oriented Programs. McGraw-Hill. Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. Chapter 12 OOP: Creating Object- Oriented Programs McGraw-Hill Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. Objectives (1 of 2) Use object-oriented terminology correctly. Create

More information

CIS Intro to Programming in C#

CIS Intro to Programming in C# OOP: Creating Classes and Using a Business Tier McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Understand how a three-tier application separates the user interface from the business

More information

Advanced Programming Using Visual Basic 2008

Advanced Programming Using Visual Basic 2008 Building Multitier Programs with Classes Advanced Programming Using Visual Basic 2008 The OOP Development Approach OOP = Object Oriented Programming Large production projects are created by teams Each

More information

Chapter 2. Building Multitier Programs with Classes The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill

Chapter 2. Building Multitier Programs with Classes The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Chapter 2 Building Multitier Programs with Classes McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Objectives Discuss object-oriented terminology Create your own class and instantiate

More information

Building Multitier Programs with Classes

Building Multitier Programs with Classes 2-1 2-1 Building Multitier Programs with Classes Chapter 2 This chapter reviews object-oriented programming concepts and techniques for breaking programs into multiple tiers with multiple classes. Objectives

More information

9/21/2010. Based on Chapter 2 in Advanced Programming Using Visual Basic.NET by Bradley and Millspaugh

9/21/2010. Based on Chapter 2 in Advanced Programming Using Visual Basic.NET by Bradley and Millspaugh Building Multitier Programs with Classes Based on Chapter 2 in Advanced Programming Using Visual Basic.NET by Bradley and Millspaugh The Object-Oriented Oriented (OOP) Development Approach Large production

More information

Data Structures (list, dictionary, tuples, sets, strings)

Data Structures (list, dictionary, tuples, sets, strings) Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in brackets: l = [1, 2, "a"] (access by index, is mutable sequence) Tuples are enclosed in parentheses: t = (1, 2, "a") (access

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming 1. What is object-oriented programming (OOP)? OOP is a technique to develop logical modules, such as classes that contain properties, methods, fields, and events. An object

More information

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity. OOPS Viva Questions 1. What is OOPS? OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.

More information

Microsoft Visual Basic 2005: Reloaded

Microsoft Visual Basic 2005: Reloaded Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 10 Creating Classes and Objects Objectives After studying this chapter, you should be able to: Define a class Instantiate an object from a class

More information

Overview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017

Overview of OOP. Dr. Zhang COSC 1436 Summer, /18/2017 Overview of OOP Dr. Zhang COSC 1436 Summer, 2017 7/18/2017 Review Data Structures (list, dictionary, tuples, sets, strings) Lists are enclosed in square brackets: l = [1, 2, "a"] (access by index, is mutable

More information

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor. 3.Constructors and Destructors Develop cpp program to implement constructor and destructor. Constructors A constructor is a special member function whose task is to initialize the objects of its class.

More information

1. A Web Form created in Visual Basic can only be displayed in Internet Explorer. True False

1. A Web Form created in Visual Basic can only be displayed in Internet Explorer. True False True / False Questions 1. A Web Form created in Visual Basic can only be displayed in Internet Explorer. 2. Windows Explorer and Internet Explorer are Web browsers. 3. Developing Web applications requires

More information

Chapter 5 Object-Oriented Programming

Chapter 5 Object-Oriented Programming Chapter 5 Object-Oriented Programming Develop code that implements tight encapsulation, loose coupling, and high cohesion Develop code that demonstrates the use of polymorphism Develop code that declares

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 05: Inheritance and Interfaces MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Inheritance and Interfaces 2 Introduction Inheritance and Class Hierarchy Polymorphism Abstract Classes

More information

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe OBJECT ORIENTED PROGRAMMING USING C++ CSCI 5448- Object Oriented Analysis and Design By Manali Torpe Fundamentals of OOP Class Object Encapsulation Abstraction Inheritance Polymorphism Reusability C++

More information

CS260 Intro to Java & Android 03.Java Language Basics

CS260 Intro to Java & Android 03.Java Language Basics 03.Java Language Basics http://www.tutorialspoint.com/java/index.htm CS260 - Intro to Java & Android 1 What is the distinction between fields and variables? Java has the following kinds of variables: Instance

More information

PROGRAMMING LANGUAGE 2

PROGRAMMING LANGUAGE 2 31/10/2013 Ebtsam Abd elhakam 1 PROGRAMMING LANGUAGE 2 Java lecture (7) Inheritance 31/10/2013 Ebtsam Abd elhakam 2 Inheritance Inheritance is one of the cornerstones of object-oriented programming. It

More information

Object Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming

Object Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming Overview of OOP Object Oriented Programming is a programming method that combines: a) Data b) Instructions for processing that data into a self-sufficient object that can be used within a program or in

More information

CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation

More information

Chapter 6. Multiform Projects The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill

Chapter 6. Multiform Projects The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Chapter 6 Multiform Projects McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Chapter Objectives - 1 Include multiple forms in an application Use a template to create an About box

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 05: Inheritance and Interfaces MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Inheritance and Interfaces 2 Introduction Inheritance and Class Hierarchy Polymorphism Abstract

More information

Lecture 18 Tao Wang 1

Lecture 18 Tao Wang 1 Lecture 18 Tao Wang 1 Abstract Data Types in C++ (Classes) A procedural program consists of one or more algorithms that have been written in computerreadable language Input and display of program output

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 5: Inheritance & Polymorphism Lecture Contents 2 What is Inheritance? Super-class & sub class Protected members Creating subclasses

More information

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia Object Oriented Programming in Java Jaanus Pöial, PhD Tallinn, Estonia Motivation for Object Oriented Programming Decrease complexity (use layers of abstraction, interfaces, modularity,...) Reuse existing

More information

CS11 Introduction to C++ Fall Lecture 7

CS11 Introduction to C++ Fall Lecture 7 CS11 Introduction to C++ Fall 2012-2013 Lecture 7 Computer Strategy Game n Want to write a turn-based strategy game for the computer n Need different kinds of units for the game Different capabilities,

More information

CMSC 132: Object-Oriented Programming II

CMSC 132: Object-Oriented Programming II CMSC 132: Object-Oriented Programming II Java Support for OOP Department of Computer Science University of Maryland, College Park Object Oriented Programming (OOP) OO Principles Abstraction Encapsulation

More information

Chapter 10 Introduction to Classes

Chapter 10 Introduction to Classes C++ for Engineers and Scientists Third Edition Chapter 10 Introduction to Classes CSc 10200! Introduction to Computing Lecture 20-21 Edgardo Molina Fall 2013 City College of New York 2 Objectives In this

More information

Java Object Oriented Design. CSC207 Fall 2014

Java Object Oriented Design. CSC207 Fall 2014 Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code

More information

CREATED BY: Muhammad Bilal Arslan Ahmad Shaad. JAVA Chapter No 5. Instructor: Muhammad Naveed

CREATED BY: Muhammad Bilal Arslan Ahmad Shaad. JAVA Chapter No 5. Instructor: Muhammad Naveed CREATED BY: Muhammad Bilal Arslan Ahmad Shaad JAVA Chapter No 5 Instructor: Muhammad Naveed Muhammad Bilal Arslan Ahmad Shaad Chapter No 5 Object Oriented Programming Q: Explain subclass and inheritance?

More information

What are the characteristics of Object Oriented programming language?

What are the characteristics of Object Oriented programming language? What are the various elements of OOP? Following are the various elements of OOP:- Class:- A class is a collection of data and the various operations that can be performed on that data. Object- This is

More information

Introduction to Programming Using Java (98-388)

Introduction 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 information

Cpt S 122 Data Structures. Introduction to C++ Part II

Cpt S 122 Data Structures. Introduction to C++ Part II Cpt S 122 Data Structures Introduction to C++ Part II Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Topics Objectives Defining class with a member function

More information

Computer Science 4U Unit 1. Programming Concepts and Skills Modular Design

Computer Science 4U Unit 1. Programming Concepts and Skills Modular Design Computer Science 4U Unit 1 Programming Concepts and Skills Modular Design Modular Design Reusable Code Object-oriented programming (OOP) is a programming style that represents the concept of "objects"

More information

Chapter 6 Introduction to Defining Classes

Chapter 6 Introduction to Defining Classes Introduction to Defining Classes Fundamentals of Java: AP Computer Science Essentials, 4th Edition 1 Objectives Design and implement a simple class from user requirements. Organize a program in terms of

More information

Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class.

Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class. 1. What is C#? C# (pronounced "C sharp") is a simple, modern, object oriented, and type safe programming language. It will immediately be familiar to C and C++ programmers. C# combines the high productivity

More information

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L

Inheritance. Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L Inheritance Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 9.1 9.4 1 Inheritance Inheritance allows a software developer to derive

More information

OVERRIDING. 7/11/2015 Budditha Hettige 82

OVERRIDING. 7/11/2015 Budditha Hettige 82 OVERRIDING 7/11/2015 (budditha@yahoo.com) 82 What is Overriding Is a language feature Allows a subclass or child class to provide a specific implementation of a method that is already provided by one of

More information

Inheritance, and Polymorphism.

Inheritance, 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 information

Lecture Contents CS313D: ADVANCED PROGRAMMING LANGUAGE. What is Inheritance?

Lecture Contents CS313D: ADVANCED PROGRAMMING LANGUAGE. What is Inheritance? CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 5: Inheritance & Polymorphism Lecture Contents 2 What is Inheritance? Super-class & sub class Protected members Creating subclasses

More information

EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1 2 Learn about class concepts How to create a class from which objects can be instantiated Learn about instance variables and methods How to declare objects How to organize your classes Learn about public

More information

VB.NET. Exercise 1: Creating Your First Application in Visual Basic.NET

VB.NET. Exercise 1: Creating Your First Application in Visual Basic.NET VB.NET Module 1: Getting Started This module introduces Visual Basic.NET and explains how it fits into the.net platform. It explains how to use the programming tools in Microsoft Visual Studio.NET and

More information

Data Abstraction. Hwansoo Han

Data Abstraction. Hwansoo Han Data Abstraction Hwansoo Han Data Abstraction Data abstraction s roots can be found in Simula67 An abstract data type (ADT) is defined In terms of the operations that it supports (i.e., that can be performed

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

Department of Computer science and Engineering Sub. Name: Object oriented programming and data structures Sub. Code: EC6301 Sem/Class: III/II-ECE Staff name: M.Kavipriya Two Mark Questions UNIT-1 1. List

More information

What is Inheritance?

What is Inheritance? Inheritance 1 Agenda What is and Why Inheritance? How to derive a sub-class? Object class Constructor calling chain super keyword Overriding methods (most important) Hiding methods Hiding fields Type casting

More information

Advanced Object-Oriented Programming. 11 Features. C# Programming: From Problem Analysis to Program Design. 4th Edition

Advanced Object-Oriented Programming. 11 Features. C# Programming: From Problem Analysis to Program Design. 4th Edition 11 Features Advanced Object-Oriented Programming C# Programming: From Problem Analysis to Program Design C# Programming: From Problem Analysis to Program Design 1 4th Edition Chapter Objectives Learn the

More information

Microsoft Visual Basic 2005: Reloaded

Microsoft Visual Basic 2005: Reloaded Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 1 An Introduction to Visual Basic 2005 Objectives After studying this chapter, you should be able to: Explain the history of programming languages

More information

Programming Using C# QUEEN S UNIVERSITY BELFAST. Practical Week 7

Programming Using C# QUEEN S UNIVERSITY BELFAST. Practical Week 7 Programming Using C# QUEEN S UNIVERSITY BELFAST Practical Week 7 Table of Contents PRACTICAL 7... 2 EXERCISE 1... 2 TASK 1: Zoo Park (Without Inheritance)... 2 TASK 2: Zoo Park with Inheritance... 5 TASK

More information

CPS 506 Comparative Programming Languages. Programming Language

CPS 506 Comparative Programming Languages. Programming Language CPS 506 Comparative Programming Languages Object-Oriented Oriented Programming Language Paradigm Introduction Topics Object-Oriented Programming Design Issues for Object-Oriented Oriented Languages Support

More information

Programming Language Concepts Object-Oriented Programming. Janyl Jumadinova 28 February, 2017

Programming 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 information

Introduction to Object- Oriented Programming

Introduction to Object- Oriented Programming Introduction to Object- Oriented Programming Reusing this material This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. http://creativecommons.org/licenses/by-nc-sa/4.0/deed.en_us

More information

Lecture 5: Inheritance

Lecture 5: Inheritance McGill University Computer Science Department COMP 322 : Introduction to C++ Winter 2009 Lecture 5: Inheritance Sami Zhioua March 11 th, 2009 1 Inheritance Inheritance is a form of software reusability

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 4(b): Inheritance & Polymorphism Lecture Contents What is Inheritance? Super-class & sub class The object class Using extends keyword

More information

EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1 2 Learn about class concepts How to create a class from which objects can be instantiated Learn about instance variables and methods How to declare objects How to organize your classes Learn about public

More information

ECE 3574: Dynamic Polymorphism using Inheritance

ECE 3574: Dynamic Polymorphism using Inheritance 1 ECE 3574: Dynamic Polymorphism using Inheritance Changwoo Min 2 Administrivia Survey on class will be out tonight or tomorrow night Please, let me share your idea to improve the class! 3 Meeting 10:

More information

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language Categories of languages that support OOP: 1. OOP support is added to an existing language - C++ (also supports procedural and dataoriented programming) - Ada 95 (also supports procedural and dataoriented

More information

Chapter 02 Building Multitier Programs with Classes

Chapter 02 Building Multitier Programs with Classes Chapter 02 Building Multitier Programs with Classes Student: 1. 5. A method in a derived class overrides a method in the base class with the same name. 2. 11. The Get procedure in a class module is used

More information

Comp 249 Programming Methodology

Comp 249 Programming Methodology Comp 249 Programming Methodology Chapter 7 - Inheritance Part A Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia University, Montreal, Canada These slides has been extracted,

More information

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program

More information

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year Object Oriented Programming Assistant Lecture Omar Al Khayat 2 nd Year Syllabus Overview of C++ Program Principles of object oriented programming including classes Introduction to Object-Oriented Paradigm:Structures

More information

Logistics. Final Exam on Friday at 3pm in CHEM 102

Logistics. Final Exam on Friday at 3pm in CHEM 102 Java Review Logistics Final Exam on Friday at 3pm in CHEM 102 What is a class? A class is primarily a description of objects, or instances, of that class A class contains one or more constructors to create

More information

M Introduction to Visual Basic.NET Programming with Microsoft.NET 5 Day Course

M Introduction to Visual Basic.NET Programming with Microsoft.NET 5 Day Course Module 1: Getting Started This module introduces Visual Basic.NET and explains how it fits into the.net platform. It explains how to use the programming tools in Microsoft Visual Studio.NET and provides

More information

OOPs 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. 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 information

Object Orientated Analysis and Design. Benjamin Kenwright

Object Orientated Analysis and Design. Benjamin Kenwright Notation Part 2 Object Orientated Analysis and Design Benjamin Kenwright Outline Review What do we mean by Notation and UML? Types of UML View Continue UML Diagram Types Conclusion and Discussion Summary

More information

Data Structures using OOP C++ Lecture 3

Data Structures using OOP C++ Lecture 3 References: th 1. E Balagurusamy, Object Oriented Programming with C++, 4 edition, McGraw-Hill 2008. 2. Robert L. Kruse and Alexander J. Ryba, Data Structures and Program Design in C++, Prentice-Hall 2000.

More information

Argument Passing All primitive data types (int etc.) are passed by value and all reference types (arrays, strings, objects) are used through refs.

Argument Passing All primitive data types (int etc.) are passed by value and all reference types (arrays, strings, objects) are used through refs. Local Variable Initialization Unlike instance vars, local vars must be initialized before they can be used. Eg. void mymethod() { int foo = 42; int bar; bar = bar + 1; //compile error bar = 99; bar = bar

More information

Programming Exercise 14: Inheritance and Polymorphism

Programming Exercise 14: Inheritance and Polymorphism Programming Exercise 14: Inheritance and Polymorphism Purpose: Gain experience in extending a base class and overriding some of its methods. Background readings from textbook: Liang, Sections 11.1-11.5.

More information

Chapter 12 Object-Oriented Programming. Starting Out with Games & Graphics in C++ Tony Gaddis

Chapter 12 Object-Oriented Programming. Starting Out with Games & Graphics in C++ Tony Gaddis Chapter 12 Object-Oriented Programming Starting Out with Games & Graphics in C++ Tony Gaddis Addison Wesley is an imprint of 2010 Pearson Addison-Wesley. All rights reserved. 12.1 Procedural and Object-Oriented

More information

Sri Vidya College of Engineering & Technology

Sri Vidya College of Engineering & Technology UNIT I INTRODUCTION TO OOP AND FUNDAMENTALS OF JAVA 1. Define OOP. Part A Object-Oriented Programming (OOP) is a methodology or paradigm to design a program using classes and objects. It simplifies the

More information

EMBEDDED SYSTEMS PROGRAMMING OO Basics

EMBEDDED SYSTEMS PROGRAMMING OO Basics EMBEDDED SYSTEMS PROGRAMMING 2014-15 OO Basics CLASS, METHOD, OBJECT... Class: abstract description of a concept Object: concrete realization of a concept. An object is an instance of a class Members Method:

More information

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub

Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub Lebanese University Faculty of Science Computer Science BS Degree Graphical Interface and Application (I3305) Semester: 1 Academic Year: 2017/2018 Dr Antoun Yaacoub 2 Crash Course in JAVA Classes A Java

More information

QUIZ. Write the following for the class Bar: Default constructor Constructor Copy-constructor Overloaded assignment oper. Is a destructor needed?

QUIZ. Write the following for the class Bar: Default constructor Constructor Copy-constructor Overloaded assignment oper. Is a destructor needed? QUIZ Write the following for the class Bar: Default constructor Constructor Copy-constructor Overloaded assignment oper. Is a destructor needed? Or Foo(x), depending on how we want the initialization

More information

CS304 Object Oriented Programming Final Term

CS304 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 information

Inheritance and Polymorphism

Inheritance and Polymorphism Object Oriented Programming Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. Al-Azhar University Website: eaymanelshenawy.wordpress.com Email : eaymanelshenawy@azhar.edu.eg

More information

Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including:

Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including: Oops known as object-oriented programming language system is the main feature of C# which further support the major features of oops including: Abstraction Encapsulation Inheritance and Polymorphism Object-Oriented

More information

Module 10 Inheritance, Virtual Functions, and Polymorphism

Module 10 Inheritance, Virtual Functions, and Polymorphism Module 10 Inheritance, Virtual Functions, and Polymorphism Table of Contents CRITICAL SKILL 10.1: Inheritance Fundamentals... 2 CRITICAL SKILL 10.2: Base Class Access Control... 7 CRITICAL SKILL 10.3:

More information

STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes

STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes Java Curriculum for AP Computer Science, Student Lesson A20 1 STUDENT LESSON A20 Inheritance, Polymorphism, and Abstract Classes INTRODUCTION:

More information

Chapter 15: Inheritance, Polymorphism, and Virtual Functions

Chapter 15: Inheritance, Polymorphism, and Virtual Functions Chapter 15: Inheritance, Polymorphism, and Virtual Functions 15.1 What Is Inheritance? What Is Inheritance? Provides a way to create a new class from an existing class The new class is a specialized version

More information

Object Oriented Design

Object Oriented Design Object Oriented Design Chapter 9 Initializing a non-static data member in the class definition is a syntax error 1 9.2 Time Class Case Study In Fig. 9.1, the class definition is enclosed in the following

More information

CS200: Advanced OO in Java

CS200: Advanced OO in Java Object Oriented Programming CS200: Advanced OO in Java n Programming paradigm using Objects : data structures consisting of data fields and methods together with their interaction. n Object? n Class? n

More information

public : int min, hour ; T( ) //here constructor is defined inside the class definition, as line function. { sec = min = hour = 0 ; }

public : int min, hour ; T( ) //here constructor is defined inside the class definition, as line function. { sec = min = hour = 0 ; } . CONSTRUCTOR If the name of the member function of a class and the name of class are same, then the member function is called constructor. Constructors are used to initialize the object of that class

More information

Inheritance -- Introduction

Inheritance -- Introduction Inheritance -- Introduction Another fundamental object-oriented technique is called inheritance, which, when used correctly, supports reuse and enhances software designs Chapter 8 focuses on: the concept

More information

Software Design and Analysis for Engineers

Software Design and Analysis for Engineers Software Design and Analysis for Engineers by Dr. Lesley Shannon Email: lshannon@ensc.sfu.ca Course Website: http://www.ensc.sfu.ca/~lshannon/courses/ensc251 Simon Fraser University Slide Set: 2 Date:

More information

Inheritance, Polymorphism, and Interfaces

Inheritance, Polymorphism, and Interfaces Inheritance, Polymorphism, and Interfaces Chapter 8 Inheritance Basics (ch.8 idea) Inheritance allows programmer to define a general superclass with certain properties (methods, fields/member variables)

More information

Java Inheritance. Written by John Bell for CS 342, Spring Based on chapter 6 of Learning Java by Niemeyer & Leuck, and other sources.

Java Inheritance. Written by John Bell for CS 342, Spring Based on chapter 6 of Learning Java by Niemeyer & Leuck, and other sources. Java Inheritance Written by John Bell for CS 342, Spring 2018 Based on chapter 6 of Learning Java by Niemeyer & Leuck, and other sources. Review Which of the following is true? A. Java classes may either

More information

Lesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014

Lesson 10A OOP Fundamentals. By John B. Owen All rights reserved 2011, revised 2014 Lesson 10A OOP Fundamentals By John B. Owen All rights reserved 2011, revised 2014 Table of Contents Objectives Definition Pointers vs containers Object vs primitives Constructors Methods Object class

More information

Chapter 14 Abstract Classes and Interfaces

Chapter 14 Abstract Classes and Interfaces Chapter 14 Abstract Classes and Interfaces 1 What is abstract class? Abstract class is just like other class, but it marks with abstract keyword. In abstract class, methods that we want to be overridden

More information

Testing Object-Oriented Software. COMP 4004 Fall Notes Adapted from Dr. A. Williams

Testing Object-Oriented Software. COMP 4004 Fall Notes Adapted from Dr. A. Williams Testing Object-Oriented Software COMP 4004 Fall 2008 Notes Adapted from Dr. A. Williams Dr. A. Williams, Fall 2008 Software Quality Assurance Lec 9 1 Testing Object-Oriented Software Relevant characteristics

More information

PART A : MULTIPLE CHOICE Circle the letter of the best answer (1 mark each)

PART A : MULTIPLE CHOICE Circle the letter of the best answer (1 mark each) PART A : MULTIPLE CHOICE Circle the letter of the best answer (1 mark each) 1. An example of a narrowing conversion is a) double to long b) long to integer c) float to long d) integer to long 2. The key

More information

Basics of Object Oriented Programming. Visit for more.

Basics of Object Oriented Programming. Visit   for more. Chapter 4: Basics of Object Oriented Programming Informatics Practices Class XII (CBSE Board) Revised as per CBSE Curriculum 2015 Visit www.ip4you.blogspot.com for more. Authored By:- Rajesh Kumar Mishra,

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 4 (a): Classes & Objects Lecture Contents 2 What is a class? Class definition: Data Methods Constructors objects Static members

More information

Practice for Chapter 11

Practice for Chapter 11 Practice for Chapter 11 MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) Object-oriented programming allows you to derive new classes from existing

More information

Object-Oriented Programming

Object-Oriented Programming - oriented - iuliana@cs.ubbcluj.ro Babes-Bolyai University 2018 1 / 56 Overview - oriented 1 2 -oriented 3 4 5 6 7 8 Static and friend elements 9 Summary 2 / 56 I - oriented was initially created by Bjarne

More information

ECE 122. Engineering Problem Solving with Java

ECE 122. Engineering Problem Solving with Java ECE 122 Engineering Problem Solving with Java Lecture 17 Inheritance Overview Problem: Can we create bigger classes from smaller ones without having to repeat information? Subclasses: a class inherits

More information

Java. Classes 3/3/2014. Summary: Chapters 1 to 10. Java (2)

Java. Classes 3/3/2014. Summary: Chapters 1 to 10. Java (2) Summary: Chapters 1 to 10 Sharma Chakravarthy Information Technology Laboratory (IT Lab) Computer Science and Engineering Department The University of Texas at Arlington, Arlington, TX 76019 Email: sharma@cse.uta.edu

More information

Chapter 4 Defining Classes I

Chapter 4 Defining Classes I Chapter 4 Defining Classes I This chapter introduces the idea that students can create their own classes and therefore their own objects. Introduced is the idea of methods and instance variables as the

More information

CS111: PROGRAMMING LANGUAGE II

CS111: PROGRAMMING LANGUAGE II 1 CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 4(b): Subclasses and Superclasses OOP OOP - Inheritance Inheritance represents the is a relationship between data types (e.g. student/person)

More information

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University

Lecture 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 information

Object-Oriented Programming (OOP) Fundamental Principles of OOP

Object-Oriented Programming (OOP) Fundamental Principles of OOP Object-Oriented Programming (OOP) O b j e c t O r i e n t e d P r o g r a m m i n g 1 Object-oriented programming is the successor of procedural programming. The problem with procedural programming is

More information