How to use functions from one class to another?

1

In a project I was using class to define functions for the whole project, and as the project is growing, there was a need to create a new file with new class and function .

In this case, I need to consume the class that makes the connection with the bank in the first file. How can I do this?

    
asked by anonymous 04.05.2017 / 20:05

2 answers

1

As @rray said, in your new file use the methods mentioned:

NovaClass.php :

require 'caminho/do/arquivo/de/conexao/arquivo.php'
require 'caminho/do/arquivo/de/funções/arquivo.php'

class NovaClass {

}
    
04.05.2017 / 21:37
0

You can use include / include_once / require / require_once in the file it will consume. link

To use methods of a class, within methods of another class, you simply instantiate the desired class and make normal use of it.

    
04.05.2017 / 21:45