#49512 [Opn->Bgs]: Not follow the Ooop's law

From: Date: Wed, 09 Sep 2009 12:57:31 +0000
Subject: #49512 [Opn->Bgs]: Not follow the Ooop's law
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-142158@lists.php.net to get a copy of this message
ID: 49512 Updated by: sjoerd@php.net Reported By: binay dot kumar at osvin dot biz -Status: Open +Status: Bogus Bug Type: *Programming Data Structures Operating System: Any PHP Version: 5.2.10 New Comment: Thank you for your bug report. You should indeed use the static keyword if you want to call a method without creating an object instance. However, PHP allows it and generates an E_STRICT warning. This is meant to work like this, therefore this is not a bug. Previous Comments: ------------------------------------------------------------------------ [2009-09-09 12:44:35] binay dot kumar at osvin dot biz Description: ------------ <?php class xyz { public function getName($id) { return $id; } } xyz::getName(1); ?> ## in the above class i can access the class xyz method by "::", however i have not created the instance of the class. by the oop's law , we can access a method by this way,method defined as static method. its working fine in both case either create a object of the class or by "::" to access. can please describe me the things because its not following the oop's law. Regards Binay Kumar ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=49512&edit=1

« previous php.bugs (#142158) next »