SlideShare une entreprise Scribd logo
1  sur  9
OOP
Object-Oriented Programming




        state



        Behavior
I       dentity
AccessSpecifier] Class Name

        {
                  Members
        }
AccessSpecifier
class
Name
Members




 ClassName ObjectName;

                                          ObjectName
                                                   new


objecyName = new ClassName([arguments])



     accessSpecifier
static)
                                                         new
                    import java.util.Scanner;
                      public class Cal_Max {
              public static void main(String args[])
                                  {
                          int num1,num2;
           Scanner stdin = new Scanner(System.in);
             System.out.print("Input Number 1 : ");
                     num1 = stdin.nextInt();
             System.out.print("Input Number 2 : ");
                     num2 = stdin.nextInt();
            int larger = TestMax.max(num1,num2);
          System.out.println("Max Data is "+larger);
                                  }
                                  }
                           class TestMax
                                  {
               static int max(int num1, int num2)
                                  {
                         if(num1 > num2)
                            return num1;
                                else
                            return num2;
                                  }
                                  }


                         Scanner
                        max                    TestMax
Constructors
                               new                               Constructors
                                          constructor                           constructure
    base class (
                                                 php
                                  class Auto_Cart extends Cart
                                                 {
                                      function Auto_Cart() {
                                    $this->add_item("10", 1);
                                                 }
                                                 }
                                                ?>
                   Constructors function

                                                php
                              class Constructor_Cart extends Cart
                                                {
                                   function Constructor_Cart(
                    $item = "10", $num = 1) { $this->add_item($item, $num);
                                                }
                                                }


//                                          Constructor function $default_cart = new
Constructor_Cart; //                        Constructor     Constructor_Cart
          default
          error
//             parameter                  different_cart = new Constructor_Cart("20", 17); ?>
Student.Java
public class Student3 {
private String name;
private String email;
              public Student3()
{
              name = "Unassigned";
              email = "Unassigned";
              }
               public String getEmail(){
              return email;
               }
               public String getName(){
               return name;
               }
              public void setEmail(String address){
                            email = address;
              }
              public void setName(String studentName){
              name = studentName;
              }
}
-                  -shift
A        C
B        D
………………..
Y       A
Z       B
                       DIZZY”                - shift      FKBBA”


                  Teerawut                    message
     Teerawut”
2.                                             shift
                             encrypt       msg
                  message               shift
             encrypt                   encryptedMessage

                       msg
                  encryptedMessage
New>Class
3.   Next
4.
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น

Contenu connexe

Tendances

Pavel kravchenko obj c runtime
Pavel kravchenko obj c runtimePavel kravchenko obj c runtime
Pavel kravchenko obj c runtimeDneprCiklumEvents
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84Mahmoud Samir Fayed
 
Design patterns with kotlin
Design patterns with kotlinDesign patterns with kotlin
Design patterns with kotlinAlexey Soshin
 
Kotlin으로 안드로이드 개발하기
Kotlin으로 안드로이드 개발하기Kotlin으로 안드로이드 개발하기
Kotlin으로 안드로이드 개발하기Taehwan kwon
 
Javascript foundations: Introducing OO
Javascript foundations: Introducing OOJavascript foundations: Introducing OO
Javascript foundations: Introducing OOJohn Hunter
 
Design patterns with Kotlin
Design patterns with KotlinDesign patterns with Kotlin
Design patterns with KotlinAlexey Soshin
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and DestructorKamal Acharya
 
Lecture 7, c++(complete reference,herbet sheidt)chapter-17.
Lecture 7, c++(complete reference,herbet sheidt)chapter-17.Lecture 7, c++(complete reference,herbet sheidt)chapter-17.
Lecture 7, c++(complete reference,herbet sheidt)chapter-17.Abu Saleh
 
What's New In Python 2.6
What's New In Python 2.6What's New In Python 2.6
What's New In Python 2.6Richard Jones
 
Constructors and destructors in C++
Constructors and destructors in  C++Constructors and destructors in  C++
Constructors and destructors in C++RAJ KUMAR
 
The Ring programming language version 1.5.4 book - Part 14 of 185
The Ring programming language version 1.5.4 book - Part 14 of 185The Ring programming language version 1.5.4 book - Part 14 of 185
The Ring programming language version 1.5.4 book - Part 14 of 185Mahmoud Samir Fayed
 
.Net Enterprise Services and their Implementations
.Net Enterprise Services and their Implementations.Net Enterprise Services and their Implementations
.Net Enterprise Services and their ImplementationsKashif Aleem
 

Tendances (20)

Constructors
ConstructorsConstructors
Constructors
 
JAVA CONCEPTS
JAVA CONCEPTS JAVA CONCEPTS
JAVA CONCEPTS
 
Pavel kravchenko obj c runtime
Pavel kravchenko obj c runtimePavel kravchenko obj c runtime
Pavel kravchenko obj c runtime
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84
 
Design patterns with kotlin
Design patterns with kotlinDesign patterns with kotlin
Design patterns with kotlin
 
Kotlin으로 안드로이드 개발하기
Kotlin으로 안드로이드 개발하기Kotlin으로 안드로이드 개발하기
Kotlin으로 안드로이드 개발하기
 
Actionscript
ActionscriptActionscript
Actionscript
 
Compile time polymorphism
Compile time polymorphismCompile time polymorphism
Compile time polymorphism
 
Javascript foundations: Introducing OO
Javascript foundations: Introducing OOJavascript foundations: Introducing OO
Javascript foundations: Introducing OO
 
Understanding Subroutines and Functions in VB6
Understanding Subroutines and Functions in VB6Understanding Subroutines and Functions in VB6
Understanding Subroutines and Functions in VB6
 
Design patterns with Kotlin
Design patterns with KotlinDesign patterns with Kotlin
Design patterns with Kotlin
 
Constructors and Destructors
Constructors and DestructorsConstructors and Destructors
Constructors and Destructors
 
Java misc1
Java misc1Java misc1
Java misc1
 
Constructor and Destructor
Constructor and DestructorConstructor and Destructor
Constructor and Destructor
 
ccc
cccccc
ccc
 
Lecture 7, c++(complete reference,herbet sheidt)chapter-17.
Lecture 7, c++(complete reference,herbet sheidt)chapter-17.Lecture 7, c++(complete reference,herbet sheidt)chapter-17.
Lecture 7, c++(complete reference,herbet sheidt)chapter-17.
 
What's New In Python 2.6
What's New In Python 2.6What's New In Python 2.6
What's New In Python 2.6
 
Constructors and destructors in C++
Constructors and destructors in  C++Constructors and destructors in  C++
Constructors and destructors in C++
 
The Ring programming language version 1.5.4 book - Part 14 of 185
The Ring programming language version 1.5.4 book - Part 14 of 185The Ring programming language version 1.5.4 book - Part 14 of 185
The Ring programming language version 1.5.4 book - Part 14 of 185
 
.Net Enterprise Services and their Implementations
.Net Enterprise Services and their Implementations.Net Enterprise Services and their Implementations
.Net Enterprise Services and their Implementations
 

Similaire à คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น

Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012Sandeep Joshi
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotationjavatwo2011
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarROHIT JAISWAR
 
Binary patching for fun and profit @ JUG.ru, 25.02.2012
Binary patching for fun and profit @ JUG.ru, 25.02.2012Binary patching for fun and profit @ JUG.ru, 25.02.2012
Binary patching for fun and profit @ JUG.ru, 25.02.2012Anton Arhipov
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iiiNiraj Bharambe
 
Type script, for dummies
Type script, for dummiesType script, for dummies
Type script, for dummiessantiagoaguiar
 
C# Starter L04-Collections
C# Starter L04-CollectionsC# Starter L04-Collections
C# Starter L04-CollectionsMohammad Shaker
 
Have Your Cake and Eat It Too: Meta-Programming Techniques for Java
Have Your Cake and Eat It Too: Meta-Programming Techniques for JavaHave Your Cake and Eat It Too: Meta-Programming Techniques for Java
Have Your Cake and Eat It Too: Meta-Programming Techniques for JavaHoward Lewis Ship
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsMuhammadTalha436
 
Advanced Java Practical File
Advanced Java Practical FileAdvanced Java Practical File
Advanced Java Practical FileSoumya Behera
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript IntroductionDmitry Sheiko
 
VPN Access Runbook
VPN Access RunbookVPN Access Runbook
VPN Access RunbookTaha Shakeel
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3Simon Su
 

Similaire à คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น (20)

Ensure code quality with vs2012
Ensure code quality with vs2012Ensure code quality with vs2012
Ensure code quality with vs2012
 
比XML更好用的Java Annotation
比XML更好用的Java Annotation比XML更好用的Java Annotation
比XML更好用的Java Annotation
 
Jersey Guice AOP
Jersey Guice AOPJersey Guice AOP
Jersey Guice AOP
 
Java programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswarJava programming lab_manual_by_rohit_jaiswar
Java programming lab_manual_by_rohit_jaiswar
 
Taming Java Agents
Taming Java AgentsTaming Java Agents
Taming Java Agents
 
Binary patching for fun and profit @ JUG.ru, 25.02.2012
Binary patching for fun and profit @ JUG.ru, 25.02.2012Binary patching for fun and profit @ JUG.ru, 25.02.2012
Binary patching for fun and profit @ JUG.ru, 25.02.2012
 
Diifeerences In C#
Diifeerences In C#Diifeerences In C#
Diifeerences In C#
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iii
 
Type script, for dummies
Type script, for dummiesType script, for dummies
Type script, for dummies
 
Awt components
Awt componentsAwt components
Awt components
 
C# Starter L04-Collections
C# Starter L04-CollectionsC# Starter L04-Collections
C# Starter L04-Collections
 
Java Programming - 04 object oriented in java
Java Programming - 04 object oriented in javaJava Programming - 04 object oriented in java
Java Programming - 04 object oriented in java
 
Have Your Cake and Eat It Too: Meta-Programming Techniques for Java
Have Your Cake and Eat It Too: Meta-Programming Techniques for JavaHave Your Cake and Eat It Too: Meta-Programming Techniques for Java
Have Your Cake and Eat It Too: Meta-Programming Techniques for Java
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ Exams
 
Inheritance
InheritanceInheritance
Inheritance
 
Advanced Java Practical File
Advanced Java Practical FileAdvanced Java Practical File
Advanced Java Practical File
 
TypeScript Introduction
TypeScript IntroductionTypeScript Introduction
TypeScript Introduction
 
VPN Access Runbook
VPN Access RunbookVPN Access Runbook
VPN Access Runbook
 
Google App Engine Developer - Day3
Google App Engine Developer - Day3Google App Engine Developer - Day3
Google App Engine Developer - Day3
 
Functional Programming
Functional ProgrammingFunctional Programming
Functional Programming
 

Plus de Finian Nian

Microsoft power point วิธีการเชิงวัตถุและการออกแบบคลาส.pptx
Microsoft power point   วิธีการเชิงวัตถุและการออกแบบคลาส.pptxMicrosoft power point   วิธีการเชิงวัตถุและการออกแบบคลาส.pptx
Microsoft power point วิธีการเชิงวัตถุและการออกแบบคลาส.pptxFinian Nian
 
Microsoft power point วิธีการเชิงวัตถุและการออกแบบคลาส.pptx
Microsoft power point   วิธีการเชิงวัตถุและการออกแบบคลาส.pptxMicrosoft power point   วิธีการเชิงวัตถุและการออกแบบคลาส.pptx
Microsoft power point วิธีการเชิงวัตถุและการออกแบบคลาส.pptxFinian Nian
 
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้นคลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้นFinian Nian
 
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้นคลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้นFinian Nian
 
รายงานการประเมินกลุ่ม4
รายงานการประเมินกลุ่ม4รายงานการประเมินกลุ่ม4
รายงานการประเมินกลุ่ม4Finian Nian
 
รายงานการประเมินกลุ่ม4
รายงานการประเมินกลุ่ม4รายงานการประเมินกลุ่ม4
รายงานการประเมินกลุ่ม4Finian Nian
 
ยอดส่งออก
ยอดส่งออก ยอดส่งออก
ยอดส่งออก Finian Nian
 

Plus de Finian Nian (9)

Microsoft power point วิธีการเชิงวัตถุและการออกแบบคลาส.pptx
Microsoft power point   วิธีการเชิงวัตถุและการออกแบบคลาส.pptxMicrosoft power point   วิธีการเชิงวัตถุและการออกแบบคลาส.pptx
Microsoft power point วิธีการเชิงวัตถุและการออกแบบคลาส.pptx
 
Microsoft power point วิธีการเชิงวัตถุและการออกแบบคลาส.pptx
Microsoft power point   วิธีการเชิงวัตถุและการออกแบบคลาส.pptxMicrosoft power point   วิธีการเชิงวัตถุและการออกแบบคลาส.pptx
Microsoft power point วิธีการเชิงวัตถุและการออกแบบคลาส.pptx
 
แปลก
แปลกแปลก
แปลก
 
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้นคลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
 
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้นคลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น
 
รายงานการประเมินกลุ่ม4
รายงานการประเมินกลุ่ม4รายงานการประเมินกลุ่ม4
รายงานการประเมินกลุ่ม4
 
รายงานการประเมินกลุ่ม4
รายงานการประเมินกลุ่ม4รายงานการประเมินกลุ่ม4
รายงานการประเมินกลุ่ม4
 
ยอดส่งออก
ยอดส่งออก ยอดส่งออก
ยอดส่งออก
 
It news
It newsIt news
It news
 

คลาสและการเขียนโปรแกรมเชิงวัตถุเบื้องต้น

  • 1. OOP Object-Oriented Programming state Behavior I dentity
  • 2.
  • 3. AccessSpecifier] Class Name { Members } AccessSpecifier class Name Members ClassName ObjectName; ObjectName new objecyName = new ClassName([arguments]) accessSpecifier
  • 4. static) new import java.util.Scanner; public class Cal_Max { public static void main(String args[]) { int num1,num2; Scanner stdin = new Scanner(System.in); System.out.print("Input Number 1 : "); num1 = stdin.nextInt(); System.out.print("Input Number 2 : "); num2 = stdin.nextInt(); int larger = TestMax.max(num1,num2); System.out.println("Max Data is "+larger); } } class TestMax { static int max(int num1, int num2) { if(num1 > num2) return num1; else return num2; } } Scanner max TestMax
  • 5. Constructors new Constructors constructor constructure base class ( php class Auto_Cart extends Cart { function Auto_Cart() { $this->add_item("10", 1); } } ?> Constructors function php class Constructor_Cart extends Cart { function Constructor_Cart( $item = "10", $num = 1) { $this->add_item($item, $num); } } // Constructor function $default_cart = new Constructor_Cart; // Constructor Constructor_Cart default error // parameter different_cart = new Constructor_Cart("20", 17); ?>
  • 6. Student.Java public class Student3 { private String name; private String email; public Student3() { name = "Unassigned"; email = "Unassigned"; } public String getEmail(){ return email; } public String getName(){ return name; } public void setEmail(String address){ email = address; } public void setName(String studentName){ name = studentName; } }
  • 7. - -shift A C B D ……………….. Y A Z B DIZZY” - shift FKBBA” Teerawut message Teerawut” 2. shift encrypt msg message shift encrypt encryptedMessage msg encryptedMessage
  • 8. New>Class 3. Next 4.