PHP: MM __construct Question

Soldato
Joined
26 Aug 2012
Posts
4,449
Location
North West
Hi All,

I have my final exam tomorrow and I need help to one question that I am struggling to answer properly.

There is a 10(10%) mark question asking to explain the magic methods __construct and __destruct. I know how to explain and implement both of them and destruct is very simple. I am struggling to understand how explaining both of these is worth 10% of a paper?

I am wondering if someone could aid me in understanding how the question is worth so much or explaining the methods in detail that deserves 10 marks.

Thanks,

James
 
Tomorrow! Leaving it a bit late, I'm not sure how your paper gets marked but give this a read:http://www.php.net/manual/en/language.oop5.decon.php

Now you obviously can explain the basics right? When an object gets created, the constructor gets initialised and you do all of your 'property/method prepping' :) And you can obviously pass arguments into the constructer:
Code:
$obj = new MyClass($arg1,$arg2);

Code:
Public Class MyClass{

public function __construct($arg1,$arg2)
{
    $this.prop1 = $arg1;
    $this._prop2 = $arg2;
}

public $prop1;
private $_prop2;

}

I assume you already know all of this (pretty basic), what type of information do you want?

I know all the basics, I am trying to understand how it can be worth so much for something so simple.
 
Exam went fine thanks! The question wasn't even on it in the end.
Only question I didn't know was asking for 5
clauses of the PCI-DSS document specifically relating to databases. I only knew three, but made a logical guess at two more, so it didn't go too bad.
 
Back
Top Bottom