/** * Created by IntelliJ IDEA. * User: Administrator * Date: 2017/1/21 * Time: 14:16 * public,private,protected的区别 *public:权限是最大的,可以内部调用,实例调用等。 *protected: 受保护类型,用于本类和继承类调用。 *private: 私有类型,只有在本类中使用。 */error_reporting(E_ALL);

class test{    public $public;    private $private;    protected $protected;    static $instance;    public  function __construct(){        $this->public    = ‘public     <br>‘;        $this->private   = ‘private    <br>‘;        $this->protected = ‘protected  <br>‘;    }    static function tank(){        if (!isset(self::$instance[get_class()]))        {            $c = get_class();            self::$instance = new $c;        }        return self::$instance;    }    public function pub_function() {        echo "you request public function<br>";        echo $this->public;        echo $this->private;        //private,内部可以调用        echo $this->protected;      //protected,内部可以调用        $this->pri_function();      //private方法,内部可以调用        $this->pro_function();      //protected方法,内部可以调用    }    protected  function pro_function(){        echo "you request protected function<br>";    }    private function pri_function(){        echo "you request private function<br>";    }}$test = test::tank();echo $test->public;echo $test->private;    //Fatal error: Cannot access private property test::$privateecho $test->protected;  //Fatal error: Cannot access protected property test::$protected$test->pub_function();$test->pro_function();  //Fatal error: Call to protected method test::pro_function() from context$test->pri_function();  //Fatal error: Call to private method test::pri_function() from context
时间: 01-19



在java程序前如果不加任何一个权限修饰符,默认是只允许包内访问,只有在同一个包内的类之间才能访问. public: 对每个人都是可用的,在任何地方的任何包内都可以访问. protected: protected处理的是继承的问题,只有子类和自己可以访问,不局限于本包. private: 只有自己可以访问.


#!/bin/bash set 'apple pie' pears peaches for i in $*           /*单引号被去掉,循环单个字符输出*/ do echo $i done [[email protected] Ex_14.02-14.31]# sh 14-14-1 apple pie pears peaches -------------------------------------------------------------- #!/bin/bash set

[email&#160;protected]一个高效的配置管理工具--Ansible configure management--翻译(六)

无书面许可请勿转载 高级playbook Finding files with variables All modules can take variables as part of their arguments by dereferencing them with {{ and }} . You can use this to load a particular file based on a variable. For example, you might want to select a

【转载】 ERROR 1045 (28000): Access denied for user [email&#160;protected] (using password: NO)

来自: 错误描述: Mysql中添加用户之后可能出现登录时提示ERROR 1045 (28000): Access denied for user的错误.删除user.user中值为NULL的,或更新NULL为test 1)delete from user where user is NULL 2)update user set user='test' where user is NULL.意外的情况: 如果上述方

[[email&#160;protected]] Omit catch error block if not needed

From [email protected], you can omit catch error block. Before: try { throw new Error('whatever'); } catch(err) { console.log(err) } Now: try { throw new Error('whatever'); } catch { console.log("error happened") } It is just a syntax sugar, if


一.测试单元     概述:用于测试JAVA代码的工具类,已内置在Eclipse中;     格式:         1.在方法的上面添加@Test;         2.对被测试的方法的要求:权限-public;返回值-void;参数-空参         [email protected]:在@Test标注的方法前执行,可以用于初始化;           @After:在@Test标注的方法后执行,可以用于释放资源; 二.注解     概述:java的一种数据类型,和类/接口在同一级别  

[SQL] - Attempted to read or write protected memory. This is often an indication that other memory is corrupt. 问题之解决

场景: 使用 Oracle.DataAccess.dll 访问数据库时,OracleDataAdapter 执行失败. 异常: System.AccessViolationException was unhandled  HResult=-2147467261  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.  Source

git push报错error: failed to push some refs to &#39;[email&#160;protected]:

$ git push -u origin master To [email protected]:xxx/xxx.git ! [rejected] master -> master (fetch first) error: failed to push some refs to '[email protected]:xxx/xxx.git' hint: Updates were rejected because the remote contains work that you do hint:


我们知道C#中通过继承可以使一个具有公共数据和方法的基类被广泛应用从而减少代码量,这样派生类会具有基类中所有成员(除构造器等),我们理所当然可以通过派生类实例来使用基类的成员.那么当基类成员被protected修饰时,我们应该怎么在派生类中使用基类成员呢,下面将介绍使用方法. 首先我们贴一段错误的使用代码: 1 class Program 2 { 3 static void Main(string[] args) 4 { 5 Console.ReadLine(); 6 7 } 8 } 9 pub


62561_silentboy Zoker3 years ago member https方式每次都要输入密码,按照如下设置即可输入一次就不用再手输入密码的困扰而且又享受https带来的极速 设置记住密码(默认15分钟): git config --global credential.helper cache 如果想自己设置时间,可以这样做: git config credential.helper 'cache --timeout=3600' 这样就设置一个小时之后失效 长期存储密码: git