473,513 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

abstract static methods?

Hello..
Was wondering shouldn't an abstract static method cause a E_STRICT ?

this is my test.

error_reporting(E_STRICT);
abstract class Test_Abstract
{
protected abstract static function testStatic();
}

class Child extends Test_Abstract
{
protected static function testStatic()
{
echo 'what';
}
}
$test = new Child();

or how should i read this

"Due to an oversight, PHP 5.0.x and 5.1.x allowed abstract static
functions in classes. As of PHP 5.2.x, only interfaces can have them."

http://php.oregonstate.edu/manual/en...compatible.php

im running 5.2.2

Sep 26 '07 #1
2 10481
Mads Lee Jensen wrote:
Hello..
Was wondering shouldn't an abstract static method cause a E_STRICT ?

this is my test.

error_reporting(E_STRICT);
abstract class Test_Abstract
{
protected abstract static function testStatic();
}

class Child extends Test_Abstract
{
protected static function testStatic()
{
echo 'what';
}
}
$test = new Child();

or how should i read this

"Due to an oversight, PHP 5.0.x and 5.1.x allowed abstract static
functions in classes. As of PHP 5.2.x, only interfaces can have them."

http://php.oregonstate.edu/manual/en...compatible.php

im running 5.2.2
Hmm... this has to work (i.e. raise an error) - there is a check in ZE
code, there is a test in tests/ and actually it does work on my self
compiled php, but not on the precomp 5.2.3 binary. Weird.

However, I think disabling abstract statics was a rather stupid action
and they definitely will be back soon, because late binding for statics
is already on the way.

--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Sep 26 '07 #2

"gosha bine" <st********@gmail.comwrote in message
news:fd*********@registered.motzarella.org...
Mads Lee Jensen wrote:
>Hello..
Was wondering shouldn't an abstract static method cause a E_STRICT ?

this is my test.

error_reporting(E_STRICT);
abstract class Test_Abstract
{
protected abstract static function testStatic();
}

class Child extends Test_Abstract
{
protected static function testStatic()
{
echo 'what';
}
}
$test = new Child();

or how should i read this

"Due to an oversight, PHP 5.0.x and 5.1.x allowed abstract static
functions in classes. As of PHP 5.2.x, only interfaces can have them."

http://php.oregonstate.edu/manual/en...compatible.php

im running 5.2.2

Hmm... this has to work (i.e. raise an error) - there is a check in ZE
code, there is a test in tests/ and actually it does work on my self
compiled php, but not on the precomp 5.2.3 binary. Weird.

However, I think disabling abstract statics was a rather stupid action
why is that?
Sep 27 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
15367
by: Murat Tasan | last post by:
so here is another general question about java... why can't you declare an abstract static method. i can envision the case (indeed i have experienced the case) where one would want an abstracct superclass, with an abstract method such that all subclasses that implement this method make that method static. basically, the abstract class...
12
3065
by: Daedalus.OS | last post by:
Ok first I'm pretty new to OOP, so my question may sound stupid to some of you. If the only answer you can provide is "get a book about OOP" then don't loose your time and mine cause it's already ordered. I'm just too curious about this one to wait for the book. I would like to know is if it's good php programming practice to use abstract...
33
3314
by: Chris Capel | last post by:
What is the rationale behind the decision not to allow abstract static class members? It doesn't seem like it's a logically contradictory concept, or that the implementation would be difficult or near-impossible. It seems like it would be useful. In fact, there's a place in my code that I could make good use of it. So why not? Chris
3
1517
by: Sunny | last post by:
Hi again, in the past I have posted here a problem with static methods and abstract classes, and Jon Skeet and Richard Lowe have helped me to clarify the things. But now I have found another problem (I have posted similar thing in vs.ide newsgroup, but I do not know if this is and IDE or C# problem, so I post it here also).
19
24564
by: Mike Ruane-Torr | last post by:
Why can't I have a static abstract method in C#? My intention is to have a class-level method that returns a string to supply information about inherited classes, and it is natural to make this static so that I don't need an instance in order to call it. However, because my class model is using a common base class, I need to make it...
2
2794
by: timpera2501 | last post by:
I am a newb to OOP programming and I'm only just starting with C#. I've done a TON of reading lately, and I'm currently in the process of modifying some of the function provided by the "TimeTracker Start-up Kit" for my needs. ****** BEGINING OF TIME TRACKER SUMMARY ***** First, in the "TimeTracker Start-Up Kit" they appear to have tried to...
5
3211
by: pali | last post by:
Hi, I was just wondering, why is not possible to make a member of a class BOTH abstract and static? MSDN says just that's in an error, not why this is so. In a nutshell, I need this: I have an abstract base class called EntityBase that all my other business objects are derived from. I want to be able to load and save them in a generic...
7
2405
by: Brybot | last post by:
Apparently it is not possible for a static class to extend an abstract class? I was wondering how else I might be able to go about my problem here? I have a base class Parent which has a static method and an abstract method. public abstract class Parent { public static bool True()
7
4454
by: jason | last post by:
In the microsoft starter kit Time Tracker application, the data access layer code consist of three cs files. DataAccessHelper.cs DataAcess.cs SQLDataAccessLayer.cs DataAcccessHelper appears to be checking that the correct data type is used DataAcess sets an abstract class and methods
2
1820
by: pinki panda | last post by:
i want to knw the diff between static class and abstract class .i would appreciate if its followed by example
0
7178
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7397
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7565
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
5704
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5103
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4759
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
1612
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
817
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
473
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.