Object Oriented Programming.

Slides:



Advertisements
Similar presentations
Continuation of chapter 6…. Nested while loop A while loop used within another while loop is called nested while loop. Q. An illustration to generate.
Advertisements

The Point Class public class Point { public double x; public double y; public Point(double x0, double y0) { x = x0; y = y0; } public double distance(Point.
Inheritance. Many objects have a hierarchical relationship –Examples: zoo, car/vehicle, card game, airline reservation system Inheritance allows software.
Department of computer science N. Harika. Inheritance Inheritance is a fundamental Object Oriented concept A class can be defined as a "subclass" of another.
Object Oriented Programming Inheritance and Polymorphism Dr. Mike Spann
Collage of Information Technology University of Palestine Advanced programming Object-Oriented Programming: Inheritance 1.
Problem Solving #1 ICS Outline Review of Key Topics Review of Key Topics Example Program Example Program –Problem 7.1 Problem Solving Tips Problem.
Polymorphism. Legal assignments Widening is legal Narrowing is illegal (unless you cast) class Test { public static void main(String args[]) { double.
Object Concepts in C# Class, object, attribute, method, message, instance, encapsulation, polymorphism, inheritance, association, persistence, Generalization/specialization,
CS 2511 Fall Features of Object Oriented Technology  Abstraction Abstract class Interfaces  Encapsulation Access Specifiers Data Hiding  Inheritance.
Inheritance #1 First questions Similar to Python? What about visibility and encapsulation? – can an object of the child class access private members.
Like our natural language. Designed to facilitate the expression and communication ideas between people and computer Like our natural language. Designed.
 Simple payroll application that polymorphically calculates the weekly pay of several different types of employees using each employee’s Earnings method.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
Object Orientation An Object oriented approach views systems and programs as a collection of interacting objects. An object is a thing in a computer system.
Object Oriented Programming: Java Edition By: Samuel Robinson.
Features of Object Oriented Programming Lec.4. ABSTRACTION AND ENCAPSULATION Computer programs can be very complex, perhaps the most complicated artifact.
Object Based Programming Chapter 8. 2 In This Chapter We will learn about classes Garbage Collection Data Abstraction and encapsulation.
Object Oriented Analysis: Associations. 2 Object Oriented Modeling BUAD/American University Class Relationships u Classes have relationships between each.
JAVA COURSE 1 Computer Engineering Association. Compile your first program Public class Hello{ public class Hello(){ System.out.println(“Hello”); } puclic.
Inheritance and Design CSIS 3701: Advanced Object Oriented Programming.
1 OOP - An Introduction ISQS 6337 John R. Durrett.
JAVA PROGRAMMING PART III. METHOD STATEMENT Form of method statement [ ] [static] ( [ ]) { } Example public static void main(String args[])
CS 2430 Day 9. Announcements Quiz 2.1 this Friday Program 2 due this Friday at 3pm (grace date Sunday at 10pm)
Interfaces An interface is like an extreme case of an abstract class – However, an interface is not a class – It is a type that can be satisfied by any.
Bank Account Example public class BankAccount { private double balance; public static int totalAccounts = 0; public BankAccount() { balance = 0; totalAccounts++;
AD Lecture #1 Object Oriented Programming Three Main Principles 1 Inheritance Encapsulation Polymorphism.
Object Oriented Programming Session # 03.  Abstraction: Process of forming of general and relevant information from a complex scenarios.  Encapsulation:
1 / 41 COP 3503 FALL 2012 SHAYAN JAVED LECTURE 5 Programming Fundamentals using Java 1.
COME 339 WEEK 1. Example: The Course Class 2 TestCourceRunCourse.
Inheritance, Polymorphism and Abstract Classes. Student Management System All students are CUNY Students CUNY Students are Queens College students, or.
Classes CSCI 201L Jeffrey Miller, Ph.D. HTTP :// WWW - SCF. USC. EDU /~ CSCI 201 USC CSCI 201L.
Subtying Kangwon National University 임현승 Programming Languages These slides were originally created by Prof. Sungwoo Park at POSTECH.
COMPUTER SCIENCE & TECHNOLOGY DEGREE PROGRAMME FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UVA WELLASSA ‏ Properties of Object Oriented Programming.
Comp1004: Building Better Objects II Encapsulation and Constructors.
Object Based Programming Chapter 8. 2 Contrast ____________________ Languages –Action oriented –Concentrate on writing ________________ –Data supports.
Inheritance. Inheritance is a mechanism in which one object acquires all the properties and behaviors of parent object Inheritance represents the IS-A.
Introduction to Programming using Java
Lecture 6 Object Oriented Programming Using Java
COMPUTER 2430 Object Oriented Programming and Data Structures I
Examples of Classes & Objects
using System; namespace Demo01 { class Program
Ch 10- Advanced Object-Oriented Programming Features
Interface.
Module 5: Common Type System
Table of Contents Class Objects.
3 Fundamentals of Object-Oriented Programming
Module 4: Implementing Object-Oriented Programming Techniques in C#
OOP’S Concepts in C#.Net
CSC 205 Java Programming II
Object Based Programming
Introduction to Computer Programming
null, true, and false are also reserved.
Classes & Objects: Examples
Encapsulation and Constructors
Object Oriented Programming
Object-Oriented Programming
Inheritance Inheritance is a fundamental Object Oriented concept
COMPUTER 2430 Object Oriented Programming and Data Structures I
مظفر بگ محمدی دانشگاه ایلام
مظفر بگ محمدی دانشگاه ایلام
class PrintOnetoTen { public static void main(String args[]) {
Chapter 5 server Side Scripting Date: 01 October 2017.
By Rajanikanth B OOP Concepts By Rajanikanth B
Chapter 11 Inheritance and Encapsulation and Polymorphism
មជ្ឈមណ្ឌលកូរ៉េ សហ្វវែរ អេច អ ឌី
CSG2H3 Object Oriented Programming
Chapter 5 Classes.
INTERFACES Explained By: Sarbjit Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
Inheritance and Polymorphism
Presentation transcript:

Object Oriented Programming. Kwangwoo Choi Department of Physics Kangwon National University Object Something perceptible by one or more of the senses, especially by vision or touch; a material thing. 2. OOP(Object Oriented Programming) 3. Abstract 4. Class 5. encapsulation 6. inheritance 7. polymorphism

noun : accountNum, password , restMoney, interest object name : account noun : accountNum, password , restMoney, interest verb: saveMoney , withdrawMoney , getRestMoney public class Account {          private String accountNum = "422-01-0903895";          private String password = "12345678";          private long restMoney = 34123415;          private float interest = 3.34F;            public void saveMoney(long amount) {                       restMoney = restMoney + amount;          }          public void withdrawMoney(long amount) {          restMoney = restMoney - amount;           }          public long getRestMoney() {                       return restMoney;          public void setInterest(float newInterest) {                       interest = newInterest; }

Make Object Account x; x = new Account(); Account x= new Account() public class Bank {          public static void main(String [] args) {                      Account x = new Account();                      x.saveMoney(100);                      x.withdrawMoney(50);                     System.out.println(x.getRestMoney());           } }

Encapsulation private String creaditCardNo; // private member         public class Encapsulation {               private String creaditCardNo; // private member              public void setCreaditCardNo(String str) {              creaditCardNo = str;                   }           public String getCreaditCardNo() {                     return creaditCardNo;                  }  } • public • protected • default • private

Inheritance class Employee { String name; Date hireDate;          Date dateOfBirth; } class Manager {        String name;        Date hireDate;        Date dateOfBirth;        String department;        Employee subordinamtes []; class Employee {       String name;       Date hireDate;      Date dateOfBirth;  } class Manager extends Employee{       String department;       Employee subordinamtes []; }