<?php
/* 7 object static Static method property memory composition and usage explanation
*/
/*class a{
public $uname=11;
static public function _a(){ // With static This method serves the class . No static Is to serve the object
echo 222;
}
}
$b=new a();
$b->_a();// Output :222
a::_a();// Output :222*/ // Static method rewriting must be a static method .
/*class c{
static function cc(){
echo 11;
}
} class d extends c{
static function cc(){
echo 333;
}
}*/ class e{
public $uname;
static $obj=NULL;
private function __construct()
{ }
static function getObj(){
if (is_null(self::$obj)){
self::$obj=new e();
}
return self::$obj;
}
}
$d=e::getObj();
$d->uname=100;
echo $d->uname."<br/>"; $e=e::getObj();
echo $e->uname; $e->uname=200;
echo $e->uname."<br/>";
echo $d->uname;

  

007- object —— static Static method property memory composition and usage of more related articles

  1. 008- object —— object $this self parent How to use the memory

    <?php /** * */ /*class Web{ private $webname; private $weburl; function __construct($webname,$web ...

  2. Java Reflection gets the object VO The attribute value ( adopt Getter Method )

    occasionally , You need to get the property values of the object dynamically . such as , To give you one List, I want you to traverse this List The properties of the object , And this List The objects are not fixed . such as , This time, User, Next time it could be Company. e.g. This time I need to make a ...

  3. js Traverse all the property names and values of the object

    /* * Used to traverse all property names and values of the specified object * obj Objects to traverse * author: Jet Mah * website: http://www.javatang.com/archives/2 ...

  4. PHP static Static properties and static methods

    Here is an analysis php Object oriented static Static properties and static method calls . About their calls ( Can I call , How to call ), We need to figure out where they are in memory , So it's very easy to understand . Static attribute . Method ( Including static and non static ) , ...

  5. php Object oriented static Static properties and static method calls

    This article mainly introduces php Object oriented static Static properties and static method calls , Examples are analyzed static The principle and calling skill of static property and static method , Friends in need can refer to This article gives an example of php in static Static properties and static ...

  6. static The principle and calling skill of static property and static method

    This article mainly introduces php Object oriented static Static properties and static method calls , Examples are analyzed static The principle and calling skill of static property and static method , Friends in need can refer to     This article gives an example of php in static Static genus ...

  7. python Class properties and object properties 、 Class and static methods

    Definition of class property and object property class LearnClass(): # Class properties cls_attr = None def __init__(self,arg): # Object properties self.obj_attr = a ...

  8. Java The arrangement of basic knowledge static Modify properties

    static keyword , We are still using more in development . stay <Java Programming idea > Here's a passage static The way is that there is no this Methods . stay static Non static methods cannot be called inside methods , On the other hand, we can ...

  9. 【JVM Chapter 6 -- object 】 Object instantiation 、 Memory layout and access location

    Let me write it out front : This article is looking at Silicon Valley JVM After the tutorial , Organized learning notes . The viewing address is as follows : Silicon Valley 2020 The latest edition of song Hongkang JVM course One . Object instantiation In the normal process of writing code , We use it class A class defined by a keyword is just a module of a class ...

Random recommendation

  1. C++ Thread pool

    I've been looking for an open source C++ Thread pool Library , I haven't found a good one after a long time , Later, the project needed , I wanted to write one myself , But by accident github There's one up there that uses boost Library implementation of threadpool, Later study The source code ...

  2. IE11 You can't bring in the outside css Solutions for

    primary : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.o ...

  3. Share a script release and tomcat Restart script

    There's a website on the line where the business is deployed tomcat On , Due to frequent online modification , It needs to be started frequently tomcat.tomcat Service comes with bin There is no restart script , Let's share an example of script release and tomcat Restart script : 1) Now the business code is changed from svn In and out ...

  4. .NET Json Resolved to Dictionary, Native code

    I've been using Microsoft's own Json, I've always wanted to try to analyze it myself Json play , So I spent a night writing a parsing class , Let's talk about the train of thought , Let's start with the simple : Such as : The standard JSon The format is as follows :{"Key":&q ...

  5. ASP.NET And SOAP Protocol usage records

    Recently, I took over the task of management system development of a company for the first time , Because companies need to have Android,IOS client , It also requires PC Web client on the client side .... The requirement for service requests naturally falls on unified interface access .... Use ASP.NET Of WEB ...

  6. PHP Learning notes -4( Time stamp )

    I'm learning PHP Time stamp , An interesting phenomenon has been found , It's about finding out strtotime() The timestamp returned by this function is different from that of others , I think I made a mistake , Later it was found that this was not the case . It's because the time zones are different , This leads to the time display ...

  7. Use .bat To execute Java Program basis

    take java The program is made to run jar after , And hope to use .bat File to call jar when , There are several points to pay attention to . 1. Set up path and classpath .bat The contents of the document are as follows : @echo off set MY_HO ...

  8. Realization ls-l function

    Implementation code #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <diren ...

  9. Git Simple command entry

    Git Global settings : git config --global user.name "kszsa" git config --global user.email "duyon ...

  10. .NET Core Development log ——Peachpie

    .NET Core With the power of the open source community, our ecosystem has been continuously injected into it , It's getting stronger and stronger , And from time to time there are some interesting projects , such as Peachpie, It makes the PHP To .NET Core Projects become possible . From creating Jane ...