Member Avatar for iamthwee

can someone explain these.

And the difference between abstract and interfaces?

These confuse me.

Ta

Also if you're asked to write a bit of code what tasks can i expect and can i assume i'll be given any resources or just pen and paper?

Recommended Answers

All 6 Replies

A singleton is a class which provides you with one, and only one, instance of that class.

The scope resolution operator is an operator that allows you access to constants and static methods of a class. You can compare it to -> which you use to access instance variables and methods.

An abstract class basically defines a set of methods. You cannot create an instance of such a class. You have to create a descendant class which must implement any and all abstract methods from the parent.

An interface defines a set of methods (no implementation), which a class implementing that interface must define.

Read more here.

i think the scope resolution operator "::", called using :: .the double colon, is a token that allows access to static, constant, and overridden properties or methods of a class. in this example below :

class Cart 
{   
private function __construct() {}
    /**
     * Fetch Cart instance
     *
     * @return Cart
     */
    public  function getInstance()
    {
        if (NULL === self::$_instance) {
            self::$_instance = new self;
        }

        return self::$_instance;
    }
}
// initialize shopping cart
// note that Cart implements Singleton pattern
$cart = Cart::getInstance();

in oop ,abstract class is a class contains at least one abstract function (may contain normal function),and it couldn't be instantiated .but the interface contains just abstract functions, it dosen't contain any normal function...

I wish it's helpfull,,,,,
%%^Murtada^%%

commented: thanks +14

check that link for more information :Click Here

Member Avatar for iamthwee

Thanks guys...

Know this might be a daft question but I know I'm going to have to write a bit of code. But I have no idea what to expect... What difficultly, if I'll be given resources (computer internet connection etc) or just a pen and pad.

Is there anyway to prepare or what?

ta

I've never had to do anything like that, so can't help. Pen and paper is about logic structures or algorithms usually. An IDE means they want to know about your actual PHP skills (indenting, commenting, variable naming, what functions do you use, usage of classes, etc.) so they can easily weed out the script kiddies.

iamthwee,it;s code ,you need to apply it,it's better to use computer.(write->test->correct wrongs->worked program!!) :))
%%^Murtada^%%

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.