Object Oriented PHP (Lesson 2: Objects & Static Methods)

An object is the implementation of a class. As discussed in lesson 1, a class is simply a blue print that outlines something. An object is the actual thing that specifies the specific details.

Objects: Implementation of a Class

Con…


This content originally appeared on DEV Community and was authored by Clean Code Studio

Twitter Follow

An object is the implementation of a class. As discussed in lesson 1, a class is simply a blue print that outlines something. An object is the actual thing that specifies the specific details.

Objects: Implementation of a Class

  • Conceptualize a band
    • A band has a name
  • A band has members
  • A band can add a member
  • A band has music
  • A band can play music

Static Methods:

  • Are callable from the class level (You don't need to create an instance of the class to call it)
  • Are considered "global to the class namespace"
  • I recommend watching the tutorial linked above to better understand static methods - the screencast does a thorough job explaining static methods.

Objects

In object-oriented programming (OOP), objects are the things you think about first in designing a program and they are also the units of code that are eventually derived from the process. ... Each object is an instance of a particular class or subclass with the class's own methods or procedures and data variables.

Static Methods

In object-oriented programming (OOP) the methods that belong to a class definition are called static methods. (Sometimes they are called class methods, but this is confusing.) A static method is part of a class definition, but is not part of the objects it creates. Important: A program can execute a static method without first creating an object!

The End

.ltag__user__id__386677 .follow-action-button { background-color: #343c35 !important; color: #f5f5f5 !important; border-color: #343c35 !important; }
cleancodestudio image

Clean Code
Java Script Design Patterns
Object Oriented Programming
JavaScript Algorithm Examples

Clean Code Studio
☕️ Code Tips
☕️ Career Advice
☕️ Developer Memes
Shiny button, Fancy ?????????? ?, Juicy Dev Tips...wanna join?

Yes, I want in! Button to go sign up for clean code studio newsletter

(Discover [50+ pages] of my personal FAANG interview notes!)

Follow @cleancodestudio on Twitter
Follow @cleancodestudio on YouTube
Follow @cleancodestudio on TikTok
Follow @cleancodestudio on Facebook
Follow @cleancodestudio on Instagram
Follow @cleancodestudio on LinkedIn
Follow @cleancodestudio on Reddit
Follow @cleancodestudio on Dev.to
Follow @cleancodestudio on Stack Overflow
Follow @cleancodestudio packages on npm
Follow @cleancodestudio packages on packagist
Star @cleancodestudio on Github


This content originally appeared on DEV Community and was authored by Clean Code Studio


Print Share Comment Cite Upload Translate Updates
APA

Clean Code Studio | Sciencx (2021-08-23T03:06:22+00:00) Object Oriented PHP (Lesson 2: Objects & Static Methods). Retrieved from https://www.scien.cx/2021/08/23/object-oriented-php-lesson-2-objects-static-methods/

MLA
" » Object Oriented PHP (Lesson 2: Objects & Static Methods)." Clean Code Studio | Sciencx - Monday August 23, 2021, https://www.scien.cx/2021/08/23/object-oriented-php-lesson-2-objects-static-methods/
HARVARD
Clean Code Studio | Sciencx Monday August 23, 2021 » Object Oriented PHP (Lesson 2: Objects & Static Methods)., viewed ,<https://www.scien.cx/2021/08/23/object-oriented-php-lesson-2-objects-static-methods/>
VANCOUVER
Clean Code Studio | Sciencx - » Object Oriented PHP (Lesson 2: Objects & Static Methods). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/08/23/object-oriented-php-lesson-2-objects-static-methods/
CHICAGO
" » Object Oriented PHP (Lesson 2: Objects & Static Methods)." Clean Code Studio | Sciencx - Accessed . https://www.scien.cx/2021/08/23/object-oriented-php-lesson-2-objects-static-methods/
IEEE
" » Object Oriented PHP (Lesson 2: Objects & Static Methods)." Clean Code Studio | Sciencx [Online]. Available: https://www.scien.cx/2021/08/23/object-oriented-php-lesson-2-objects-static-methods/. [Accessed: ]
rf:citation
» Object Oriented PHP (Lesson 2: Objects & Static Methods) | Clean Code Studio | Sciencx | https://www.scien.cx/2021/08/23/object-oriented-php-lesson-2-objects-static-methods/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.