开发者

PHP Interface and func_get_args

How would I write an interface that would enforces the classes that implements it to use func_get_args?

Example:

interface SomeInterface{
    function somefunc(); // ???????
}

class SomeClass implements SomeInterface{
    开发者_StackOverflow中文版function somefunc(){
        $args = func_get_args();
    }
}


An interface is pure design. The interface doesn't care what its implementation is.


You cannot in PHP. Document the function carefully in the interface.

Most interfaces should contain more lines of comments - explaining what the functions should do when implemented - than actual interface declarations.


interface SomeInterface{
    function func_get_args(); // ???????
}

class SomeClass implements SomeInterface{
    function func_get_args(){
        //Implement the code for the above function
    }
}

The above is the way to write the interface

Is that the one are you looking?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜