I am confused with public, private, protected, and this and self. I have already written a blog post about public, private, and protected. The following describes how to use this, self, and parent.
1, this
1. to use this, you must be in a situation like this. Otherwise, it will report an error: Fatal error: Using $ this when not in object context.2. this can call methods and attributes in this class, or call methods and attributes that can be called in the parent class.
II. self
1. self can ac
One, this
1, to use this, you will have a situation of the image, otherwise it will error, Fatal error:using $this when the not in object context.2,this can call methods and properties in this class, or can call the adjustable methods and properties in the parent class
Two, self
1,self can access static properties and static methods in this class, and can access static and static methods in the parent class.2, when using self, you can not instantiate the
Third, parent
1,parent can access static
"11111"> 1.txt,> there is a 1 above, which is the default.> When redirected to a file, the file is cleared and written.
In this example, you can clear the content in the 1.txt file. In fact, it is easy to understand. after clearing the file, it is of course empty if you do not enter the content.
2,> Usage
[Zhangy @ localhost ~] $ Echo "2222"> 2.txt
[Zhangy @ localhost ~] $ Cat 2.txt
2222
[Zhangy @ localhost ~] $ Echo "2222"> 2.txt
[Zhangy @ localhost ~] $ Cat 2.txt
2222
2222
As shown i
Application Scenario Description: if we need to develop a tank for the game, in addition to a variety of different types of tanks, we also hope to add one or more of the following features for it in different occasions, for example, infrared night vision functions, such as amphibious functions, such as satellite positioning functions;
In general, we may do this during programming:
// Define the abstract class of the
VoidTick ();
}
For any type that implements the actor interface, only one tick command is sent.
See the example below:
We will create two classes, tank and map, inherited from Sprite and tiledlayer, which both implement the actor interface. Create Frame Animation for tank, create dynamic graph blocks for map, and display them in scenemain.
First, we can copy the example in Chapter 10 to create a new projec
1, this
1. to use this, you must be in a situation like this. Otherwise, it will report an error: Fatal error: Using $ this when not in object context.2. this can call methods and attributes in this class, or call methods and attributes that can be called in the parent class.
Ii. self
1. self can access static attributes and static methods in this class, and can access static attributes and static methods in the parent class.2. When using self, you do not need to instantiate
3. parent
1. parent
Java Dynamic proxy ModeProxy: a role represents another role to implement some specific functions.For example, the relationship between producers, middlemen, and customersCustomers who buy products do not directly deal with producers, nor do they know how the products are produced. Customers only deal with middlemen, and middlemen can carry some packaging on the products, provide some after-sales services.
Proxy mode has three roles: 1. Abstract topic role 2. Proxy topic role 3. Real-time proxy
Environment Description:Copy volume, CentOS 7, gluster version 3.6.7Failure phenomena:# Gluster v Status tankStatus of Volume:tankGluster processPortOnlinePid------------------------------------------------------------------------------Brick w-ostack03.sys.bjdt.net:/data/tank49152Y30371Brick w-ostack04.sys.bjdt.net:/data/tankn/ANFS Server on localhost2049Y29320Self-heal Daemon on localhostn/a Y 29337NFS Server on w-ostack03.sys.bjdt.net2049Y17638Self-heal Daemon on w-ostack03.sys.bjdt.netn/a Y 3
saves the events from each water pipe, waits for two tanks to have events, and then pulls out an event from the tank to combine, waiting when one of the tanks is empty.Off-topic: Let's analyze the characteristics of this water tank. It is in order to save, advanced events first taken out, this feature is not very familiar with it? Yes, this is what we know the queue, the water
One, this
1, to use this, you have to be a situation of the image, otherwise it will be an error, Fatal error:using $this when not in the object context.2,this can call methods and properties in this class, or you can call methods and properties that are adjustable in the parent class
Two, self
1,self can access static and static methods in this class, and you can access static properties and static methods in the parent class.2, when you use self, you can not instantiate the
Third, parent
1320: scoop watertime limit: 2 sec memory limit: 128 MB
Submit: 494 solved: 129
[Submit] [Status] [web board]
Description
I just bought two water polo a and B today, and the capacity is 1 litre. He plans to use this water polo to play games.
First, the supervisor has prepared a water tank with an infinite capacity. At the beginning, the water tank is empty. Then, the water
Method One: Particle systemsOSG particle systems have their own defined modules, such as osgparticle::explosioneffect (Explosion simulation), Osgparticle::smokeeffect (smoke simulation); Osgparticle:: Fireeffect (flare Simulation). I think the smoke simulation and flare simulation can be used to display the alarm effects. OSG Adding a osgparticle particle effect to the scene:Add a custom Osgparticle instance to the scene to simulate the soot generated when the
History
The history command can be used to display commands that have been executed, or to perform the required commands according to the treatment shown
N shows n recent records
-A Add records
-R reads records but does not add content records
-W Overwrite original history file
-C purge Record
-d
-n
-r
-w
Example 1
The code is as follows:
[Root@redhat ~]# History #查看所有执行过的命令
1 ls
2 pwd
3 fc-l
4 history
The code is as follows:
[Root@redhat ~]# History 2 #显示2条
4 history
5 Hist
History
The history command can be used to display commands that have been executed, or to perform the required commands according to the treatment shown
N shows n recent records-A Add records-R reads records but does not add content records-W Overwrite original history file-C purge Record-d-n-r-w
Example 1
The code is as follows:
[Root@redhat ~]# History #查看所有执行过的命令
1 ls2 pwd3 fc-l4 history
The code is as follows:
[Root@redhat ~]# History 2 #显示2条
Title Description:With highways available, driving a car from Hangzhou to any other city are easy. But since the tank capacity of a car was limited, we have to find gas stations on the the-on-the-the-the-time. Different give Different price. You is asked to carefully design the cheapest route to go.1#include 2#include 3#include 4#include 5 using namespacestd;6 7typedefstruct{8 Doublepri;9 intdis;Ten }station; One A BOOLcmpConstStation AMP;A
Understanding the space used by zfsby Brian Leonard on Sep 28,201 0
Until recently, I 've been confused and frustrated by the ZFS list output as I try to clear up space on my hard drive.
Take this example using a 1 GB zpool:
[emailprotected]:~# mkfile 1G /dev/dsk/disk1[emailprotected]:~# zpool create tank disk1[emailprotected]:~# zpool list tankNAME SIZE USED AVAIL CAP HEALTH ALTROOTtank 1016M 73K 1016M 0% ONLINE -
Now let's cr
I think most people will be concerned about this problem when they learn multithreading, although the concept of multi-threading is not difficult to understand, when should we use it? In most cases, we wrote the program, found that sometimes we have to use multithreading to get the desired results, so we call the relevant thread class library or API to improve the program according to the data, and make it run normally, but there is no basis of judgment Can you clearly instruct us to use multith
Here the content is more complex, to achieve is toarbitrary interface, for any specified method, and for any specified proxy typeThe agent, it is more realistic to simulate the dynamic agent mechanism of Java Virtual machinelist the relationship between the classes and interfaces involved, so that we could learn. 1, Invocationhandler interface, used to handle the specified method, that is, the agent for a particular method, the implementation of the specific processing by the subclass implementa
First game preliminary plan
Before Game Development, you usually need to perform preliminary analysis and planning on your own game. Organize and analyze all foreseeable problems.
Although simple game planning can be built in mind. But as a tutorial, let's proceed with the process.
First, I decided what kind of game I was doing. I thought it would be a tank war for the red and white machines.
Because you can find a full set of
added to the display liststageThe property is setnull
Ii. Problems Caused by stage
I have encountered such a problem that I wrote in the main document class and other tank classes in the tank class
Stage. addeventlistenr ();
The keyboard operation defined in the tank class is totally invalid.
Tank Class:
For example
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.