Welcome Guest, Not a member yet? Register   Sign In
object oriented class
#3

[eluser]Rolly1971[/eluser]
the way your doing it is not needed.

for example

Code:
public function index()
    {
                $number = new $this->numbersclass->numbers("5","45");

                echo $number->multiply_numbers();

                echo $numbers->divide_numbers();

                echo $numbers->subtract_numbers();

          }

is better written like:

Code:
public function index()
    {
                $this->numbersclass->numbers("5","45");
                echo $this->numbersclass->multiply_numbers();

                echo $this->numbersclass->divide_numbers();

                echo $this->numbersclass->subtract_numbers();

          }

because the way CI works is when it loads a class using: $this->load->library('classname') a reference object is automatically created with the same name as the class.

the way you are coding it your creating a reference to a class from a reference to a class which is a bit in-efficient.


Messages In This Thread
object oriented class - by El Forum - 08-12-2011, 06:29 PM
object oriented class - by El Forum - 08-13-2011, 12:08 AM
object oriented class - by El Forum - 08-13-2011, 12:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB