I'm trying to understand how Object Oriented Programming works and as an exercise I was going to try to make a kind of video store using this concept and not SQL.
The question is that I made the code below and if I did not understand wrong. I did the following,
1) I declare the class. In this case film.
2) I declare the variables with which I am going to work.
3) I declare a constructor method so that initially these variables have a value. In my indefinite case.
4) I already define each film with its respective title, year ... linked to the constructor method.
5) I show the movie that I want. (Later this would be done with some html input).
<?PHP
class Pelicula{
var $Titulo; // Defino las propiedades que tendrán los objetos
var $TituloOriginal;
var $Anyo;
var $Duracion;
function Pelicula(){ // Declaro constructor. Es decir, el valor de las propiedades al iniciarse
$this -> Titulo = ""; // Lo declaro como indefinido
$this -> TituloOriginal = "";
$this -> Anyo = "";
$this -> Duracion = "";
}
function IJArcaPerdida(){
$this -> Titulo = "Indiana Jones en busca del arca perdida";
$this -> TituloOriginal = "Raiders of the lost ark";
$this -> Anyo = "1981";
$this -> Duracion = "115 min";
}
function IJTemploMaldito(){
$this -> Titulo = "Indiana Jones y el templo maldito";
$this -> TituloOriginal = "Indiana Jones and the Temple of Doom";
$this -> Anyo = "1984";
$this -> Duracion = "118 min";
}
echo IJTemploMaldito();
}
?>
I can not show it and I've done tests, with echo, new ... but I do not know how it's done. I know it must be fatal but I do not finish understanding the issue of poo
and I have already consulted several tutorials and threads ...