Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Cadastro</title>
- </head>
- <body>
- <pre>
- <?php
- require_once 'Cadastro.php';
- $cad1 = new Cadastro();
- $cad1-> setNome("Fulano");
- $cad1->setSobrenome("Silva");
- $cad1->setIdade(18);
- $cad1->setEmail("Teste@teste.com");
- $cad1->setSenha("Abc123");
- print_r($cad1);
- ?>
- </pre>
- </body>
- </html>
- //classe//
- <?php
- class Cadastro{
- private $nome;
- private $sobrenome;
- private $idade;
- private $email;
- private $senha;
- /*descomente e defina os valores na instancia
- caso queira inicar com algum valor
- $cad1("fulano","Silva","18","teste@teste","abc123");
- public function __construct($n,$s,$i,$e,$s){
- $this->nome=$n;
- $this->sobrenome=$s;
- $this->idade=$i;
- $this->email=$e;
- $this-senha=$s;
- }
- */
- public function getNome(){
- return $this->nome;
- }
- public function setNome($n){
- $this->nome=$n;
- }
- public function getSobrenome(){
- return $this->sobrenome;
- }
- public function setSobrenome($s){
- $this->sobrenome=$s;
- }
- public function getIdade(){
- return $this->idade;
- }
- public function setIdade($i){
- $this->idade=$i;
- }
- public function getEmail(){
- return $this->email;
- }
- public function setEmail($e){
- $this->email=$e;
- }
- public function getSenha(){
- return $this->senha;
- }
- public function setSenha($s){
- $this->senha=$s;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement