Bayu Priyambadha, S.Kom.  Classes, which are the "blueprints" for an object and are the actual code that defines the properties and methods.  Objects,

Slides:



Advertisements
Presentasi serupa
Database Android Dwi Muktianto
Advertisements

Workshop SCS: Java Game Programming
Lecture 2 Introduction to C# - Object Oriented Sandy Ardianto & Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
OBJECT ORIENTED PROGRAMMING
Function.
P EMROGRAMAN W EB II Lasmedi afuan, ST.,M.Cs. T OPIC CI URL Controller View.
Pemrograman Berbasis Obyek
Class, Inheritance, Encapsulation & Interface
06/10/2014 Course : Rekayasa Perangkat Lunak, Aetthea, Elektro Unsoed,
Lecture 2 Object-oriented Programming Concepts Erick Pranata © Sekolah Tinggi Teknik Surabaya 1.
Pemrograman Berorientasi Obyek Oleh Tita Karlita
Review :: Kisi-kisi UTS ::
Class Member Access Control
OBJECT ORIENTED PROGRAMMING YANES HARDIANTO SUI Politeknik Manufaktur Astra 2011.
ARRAY RUBY. PENDAHULUAN Ruby's arrays are untyped and mutable. The elements of an array need not all be of the same class, and they can be changed at.
Enkapsulasi Pemrograman Berorientasi Obyek Oleh Tita Karlita.
K-Map Using different rules and properties in Boolean algebra can simplify Boolean equations May involve many of rules / properties during simplification.
Center of Young Scientists Mummy Method for Determination of 3D Irregular Body Surface Area Pasca Nadia Fitri, et. al. Pandapotan Harahap, M.Pd., M.P.Fis.
1 DATA STRUCTURE “ STACK” SHINTA P STMIK MDP APRIL 2011.
Class and Object Introduction Specifying a Class Defining Member Function A C++ Program with Class Nesting of Member Functions Private Member Functions.
Testing Implementasi Sistem Oleh :Rifiana Arief, SKom, MMSI
The steps to work with Power Point click Start> All Programs> Microsoft Office> Microsoft Office PowerPoint2007 klik Start>All Programs>Microsoft.
Menulis Kolom  Kolom adalah opini atau artikel. Tidak seperti editorial, kolom memiliki byline.  Kolom Biasanya ditulis reguler. Biasanya mingguan atau.
1 Pertemuan 12 Pengkodean & Implementasi Matakuliah: T0234 / Sistem Informasi Geografis Tahun: 2005 Versi: 01/revisi 1.
Masalah Transportasi II (Transportation Problem II)
1 Pertemuan 5 Encapsulation Matakuliah: T0044/Pemrograman Berorientasi Obyek Tahun: 2005 Versi: 1.0.
1 Pertemuan 21 Function Matakuliah: M0086/Analisis dan Perancangan Sistem Informasi Tahun: 2005 Versi: 5.
PERTEMUAN KE-6 UNIFIED MODELLING LANGUAGE (UML) (Part 2)
1 Pertemuan 11 Function dari System Matakuliah: M0446/Analisa dan Perancangan Sistem Informasi Tahun: 2005 Versi: 0/0.
1 Pertemuan 10 Pemrograman Berorientasi Objek Matakuliah: >/ > Tahun: > Versi: >
9.3 Geometric Sequences and Series. Objective To find specified terms and the common ratio in a geometric sequence. To find the partial sum of a geometric.
F ORM Bayu Priyambadha, S.Kom. F ORM Form is the interface (user interface) for users to communicate with the application system. Each posted data from.
Binary Search Tree. Sebuah node di Binary Search Tree memiliki path yang unik dari root menurut aturan ordering – Sebuah Node, mempunyai subtree kiri.
Chapter 10 – The Design of Feedback Control Systems PID Compensation Networks.
-Do you have a close friend? Does she/he have a problem? -What do you say when she/he tells her/his problem? - Did you ever come to your friend house?
OPERATOR DAN FUNGSI MATEMATIK. Operator  Assignment operator Assignment operator (operator pengerjaan) menggunakan simbol titik dua diikuti oleh tanda.
Visual Basic for Aplications in powerpoint. What is Visual Basic for Aplications? Visual Basic for Applications (VBA) is a very powerful objectoriented.
Perancangan dan Pemrograman Web
ILIMA FITRI AZMI TEACHING MATERIAL DEVELOPMENT
Enkapsulasi.
Pert. 16. Menyimak lingkungan IS/IT saat ini
Rekayasa Perangkat Lunak Class Diagram
Intro to OOP Yesi Novia, S.Kom.
Advanced Socket Programming
Association, Composition dan Inheritance
CLASS DIAGRAM.
Pemrograman Berorientasi Objek
REAL NUMBERS EKSPONENT NUMBERS.
Kk ilo Associative entity.
Pertemuan 4 CLASS DIAGRAM.
An assessment of Pedestrian Ways in Unsyiah
How to Set Up AT&T on MS Outlook ATT is a multinational company headquartered in Texas. ATT services are used by many people widely across.
How You Can Make Your Fleet Insurance London Claims Letter.
How Can I Be A Driver of The Month as I Am Working for Uber?
How the Challenges Make You A Perfect Event Organiser.
Things You Need to Know Before Running on the Beach.
How to Pitch an Event
Don’t Forget to Avail the Timely Offers with Uber
Takes Rides for Never Ending Fun pacehire.co.uk. It’s still Time to Make Fun Before the Holidays pacehire.co.uk.
Take a look at these photos.... Also, in case you're wondering where this hotel is, it isn't a hotel at all. It is a house! It's owned by the family of.
Group 3 About causal Conjunction Member : 1. Ahmad Fandia R. S.(01) 2. Hesti Rahayu(13) 3. Intan Nuraini(16) 4. Putri Nur J. (27) Class: XI Science 5.
Algoritma & Pemrograman 1 Achmad Fitro The Power of PowerPoint – thepopp.com Chapter 3.
 Zoho Mail offers easy options to migrate data from G Suite or Gmail accounts. All s, contacts, and calendar or other important data can be imported.
Fix problems opening Norton  Fix problems opening Norton This problem can happen after you update Norton. To fix the matter, restart the computer. Fix.
Pemrograman berorientasi objek
Website: Website Technologies.
Rank Your Ideas The next step is to rank and compare your three high- potential ideas. Rank each one on the three qualities of feasibility, persuasion,
Draw a picture that shows where the knife, fork, spoon, and napkin are placed in a table setting.
2. Discussion TASK 1. WORK IN PAIRS Ask your partner. Then, in turn your friend asks you A. what kinds of product are there? B. why do people want to.
HOW TO IMPROVE YOUR PUBLIC SPEAKING SKILLS. 2 3 INIKAH YANG SERING ANDA ALAMI SAAT PRESENTASI?
Transcript presentasi:

Bayu Priyambadha, S.Kom

 Classes, which are the "blueprints" for an object and are the actual code that defines the properties and methods.  Objects, which are running instances of a class and contain all the internal data and state information needed for your application to function.  Encapsulation, which is the capability of an object to protect access to its internal data  Inheritance, which is the ability to define a class of one kind as being a sub-type of a different kind of class (much the same way a square is a kind of rectangle).

 Let's start with a simple example. Save the following in a file called class.lat.php: <?php class Demo { } ?>

 The Demo class isn't particularly useful if it isn't able to do anything, so let's look at how you can create a method. <?php class Demo { function SayHello($name) { echo “Hello $name !”; } ?>

 Adding a property to your class is as easy as adding a method. <?php class Demo { public $name; function SayHello() { echo “Hello $this->$name !”; } ?>

 You can instantiate an object of type Demo like this: <?php require_once('class.lat.php'); $objDemo = new Demo(); $objDemo->name = “Bayu”; $objDemo->SayHallo(); ?>

 There are three different levels of visibility that a member variable or method can have :  Public ▪ members are accessible to any and all code  Private ▪ members are only accessible to the class itself  Protected ▪ members are available to the class itself, and to classes that inherit from it Public is the default visibility level for any member variables or functions that do not explicitly set one, but it is good practice to always explicitly state the visibility of all the members of the class.

 Try to change access level of property named “name” to private of previous code.  What the possible solution of this problem?  Make the getter and setter function... Always use get and set functions for your properties. Changes to business logic and data validation requirements in the future will be much easier to implement.

 It is possible to define constant values on a per-class basis remaining the same and unchangeable.  Constants differ from normal variables in that you don't use the $ symbol to declare or use them  The value must be a constant expression, not (for example) a variable, a property, a result of a mathematical operation, or a function call

<?php class MyClass { const constant = 'constant value'; function showConstant() { echo self::constant. "\n"; } } echo MyClass::constant. "\n"; ?> <?php class MyClass { const constant = 'constant value'; function showConstant() { echo self::constant. "\n"; } } echo MyClass::constant. "\n"; ?>

 Declaring class properties or methods as static makes them accessible without needing an instantiation of the class.  A property declared as static can not be accessed with an instantiated class object

staticValue(). "\n"; print $foo- >my_static. "\n"; // Undefined "Pro perty" my_static print $foo::$my_static. "\n"; $classname = 'Foo'; print $classname::$my_static. "\n"; // As of PHP print Bar::$my_static. "\n"; $bar = new Bar(); print $bar->fooStatic(). "\n"; ?>

 Constructor is the method that will be implemented when object has been initiated  Commonly, constructor is used to initialize the object  Use function __construct to create constructor in PHP <?php class Demo { function __construct { } ?>

 Destructor, is method that will be run when object is ended <?php class Demo { function __destruct { } ?>

 There are many benefits of inheritance with PHP, the most common is simplifying and reducing instances of redundant code.

class hewan { protected $jml_kaki; protected $warna_kulit; function __construct() { } function berpindah() { echo "Saya berpindah"; } function makan() { echo "Saya makan"; } class hewan { protected $jml_kaki; protected $warna_kulit; function __construct() { } function berpindah() { echo "Saya berpindah"; } function makan() { echo "Saya makan"; }

class kucing extends hewan { function berpindah() { echo "Saya merangkak dengan 4 kaki"; } class burung extends hewan { protected $sayap; function berpindah() { echo "Saya terbang"; } function makan() { echo "Saya makan dengan mematuk"; } class monyet extends hewan { } class kucing extends hewan { function berpindah() { echo "Saya merangkak dengan 4 kaki"; } class burung extends hewan { protected $sayap; function berpindah() { echo "Saya terbang"; } function makan() { echo "Saya makan dengan mematuk"; } class monyet extends hewan { }

 Class product :  name  price  discount  Class CDMusic :  artist  Genre  Class CDRack  capacity  model

 CDMusic  Menuruni name, price dan discount dari Product  Price = price + 10%  Ada penambahan 5% pada discount  CDRack  Menuruni name, price dan discount dari Product  Price = price + 15%  Tidak ada penambahan discount  Buatlah code dalam PHP, serta simulasi untuk kasus tersebut!

<?php echo “Terima Kasih....!!!” ?>