Advertisement
Gepoko

Asignatura PHP

Apr 24th, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. <?php
  2.  
  3. class Asignatura{
  4.    
  5.     private $nombre;
  6.     private $codigo;
  7.     private $curso;
  8.    
  9.     function __construct($nombre, $codigo, $curso){
  10.        
  11.         $this->nombre=$nombre;
  12.         $this->codigo=$codigo;
  13.         $this->curso=$curso;
  14.        
  15.     }
  16.    
  17.    
  18.     public function setNombre($nombre){
  19.        
  20.         $this->nombre=$nombre;
  21.     }
  22.    
  23.     public function setCodigo($codigo){
  24.        
  25.         $this->codigo=$codigo;
  26.     }
  27.    
  28.     public function setCurso($curso){
  29.        
  30.        $this->curso=$curso;
  31.     }
  32.    
  33.  
  34.     public function Vis(){
  35.        
  36.         echo'La asignatura '.$this->nombre.' tiene codigo '.$this->codigo.' es del curso '.$this->curso;
  37.     }
  38.  
  39. }
  40. $a = new Asignatura("Programacion",1007,"curso 1");
  41. $a->Vis();
  42.  
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement