1 / 5

Programación Orientada a Objetos

Programación Orientada a Objetos. CLASES de objeto. OBJETOS. calzada1. Calzada. Coche. Señal. arbol_1. Arbol. arbol_2. coche1. coche2. coche3. señal_1. Señal_2. objeto coche1. Clase Coche. objeto coche2. objeto coche3. CLASES. Coche.java. class Coche () {

uzuri
Télécharger la présentation

Programación Orientada a Objetos

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programación Orientada a Objetos

  2. CLASES de objeto OBJETOS calzada1 Calzada Coche Señal arbol_1 Arbol arbol_2 coche1 coche2 coche3 señal_1 Señal_2

  3. objeto coche1 Clase Coche objeto coche2 objeto coche3

  4. CLASES Coche.java • class Coche () • { • String modelo; • String matricula; • String color; • intvelocidadMax; • intvelocidadActual; • StringgetModelo() • { • return modelo; • } • void acelerar(int aumento) • { • velocidadActual = • velocidadActual + aumento • } • . . . • } clase Coche Propiedades Métodos • modelo • matricula • color • velocidadMax • velocidadActual Propied. • setModelo() • setMatricula() • setColor() • acelerar() • frenar() • getModelo() • getMatricula() • getColor() • getVelocidad() Métodos

  5. OBJETOS objeto coche1 Propiedades • modelo = Ford Z • matricula = BHJ 345 • Color = Amarillo • velocidadMax = 170 • velocidadActual = 15 usar coche1 • coche1.setModelo(‘Ford Z’) • coche1.setMatricula(‘BHJ 345’) • coche1.setColor(‘Amarillo’) • coche1.acelerar(10) • coche1.acelerar(10) • coche1.frenar(5) • ‘Ford Z’ ◄ coche1.getModelo() • ‘BHJ 345’◄ coche1.getMatricula() • ‘Amarillo’◄ coche1.getColor() • 15 ◄ coche1.getVelocidad() crear coche1 coche1 = new(Coche)

More Related