SlideShare a Scribd company logo
1 of 4
Download to read offline
Class 7 y 8
    Exposure: Group #1 and Group #2



      Group #1

           INHERITANCE(Herencia)
Allows the creation of new classes based on existing classes.
When you inherit from an existing class, we reuse (or inherit ) methods
and fields and add new fields and methods to meet the new situation.
The existing class is called the super class or base class, or parent class.
The new class is called subclass, derived class, or child class.




Inheritance Hierarchy
EXAMPLO




                          Tipos de herencia

Single inheritance

· A class can inherit from a single Class.

Example: Java, C #




Multiple Inheritance

· A class can inherit from multiple classes .

· Classes form a directed acyclic graph

Examples : Eiffel , C++
Example



1.-

               package herencia;

               public class ClaseHeredada {

                   String Apellido;

                   public ClaseHeredada(String Dato) {

                     this.Apellido=Dato;}

               }




2.-
      package herencia;

      public class Herencia extends ClaseHeredada{

        String Nombre;

        public Herencia(String Texto){

             super(Texto);

        }

        public void setPersona(String NombrePer){

             this.Nombre=NombrePer+this.Apellido;

        }

        public String getPersona(){

             return Nombre;

        }}
Group #2


                           POLYMORPHISMS
 Is the ability of a class of objects respond to the same message or event based on the
 parameters used during its invocation .A polymorphic object is an entity that can hold
 values of different types during program execution .


 Classification


      dynamic polymorphism
      static polymorphism




public class Articulo {
 private float precio;
 public void setPrecio() {
  precio = 3.50;
 }
 public void setPrecio(float nuevoPrecio) {
  precio = nuevoPrecio;
 }
 public void setPrecio(float costo, int porcentajeGanancia) {
     precio = costo + (costo * porcentajeGanancia);
   }
}

More Related Content

Viewers also liked

Portafolio de ingles carlos alcivar mera
Portafolio de ingles   carlos alcivar meraPortafolio de ingles   carlos alcivar mera
Portafolio de ingles carlos alcivar meraCarlos Alcivar
 
Portafolio de ingles carlos alcivar mera
Portafolio de ingles   carlos alcivar meraPortafolio de ingles   carlos alcivar mera
Portafolio de ingles carlos alcivar meraCarlos Alcivar
 
The stranger jose
The stranger jose The stranger jose
The stranger jose msvalcik
 
The stranger balanca
The stranger balancaThe stranger balanca
The stranger balancamsvalcik
 
Pablo the stranger 200
Pablo  the stranger 200Pablo  the stranger 200
Pablo the stranger 200msvalcik
 
The stranger.ppt niobe [recovered]
The stranger.ppt niobe [recovered]The stranger.ppt niobe [recovered]
The stranger.ppt niobe [recovered]msvalcik
 
High ticket sales funnel #3 launch funnel
High ticket sales funnel #3 launch funnelHigh ticket sales funnel #3 launch funnel
High ticket sales funnel #3 launch funnelDallas McMillan
 
High ticket sales funnel #2 webinar funnel
High ticket sales funnel #2 webinar funnelHigh ticket sales funnel #2 webinar funnel
High ticket sales funnel #2 webinar funnelDallas McMillan
 
Quesflickr 091013022733-phpapp02
Quesflickr 091013022733-phpapp02Quesflickr 091013022733-phpapp02
Quesflickr 091013022733-phpapp02LILIBETH MELO H
 

Viewers also liked (16)

Portafolio de ingles carlos alcivar mera
Portafolio de ingles   carlos alcivar meraPortafolio de ingles   carlos alcivar mera
Portafolio de ingles carlos alcivar mera
 
Portafolio de ingles carlos alcivar mera
Portafolio de ingles   carlos alcivar meraPortafolio de ingles   carlos alcivar mera
Portafolio de ingles carlos alcivar mera
 
Class 3 2ciclo
Class 3 2cicloClass 3 2ciclo
Class 3 2ciclo
 
Que es flickr?
Que  es flickr?Que  es flickr?
Que es flickr?
 
The stranger jose
The stranger jose The stranger jose
The stranger jose
 
Class 5 2ciclo
Class 5 2cicloClass 5 2ciclo
Class 5 2ciclo
 
Proyect of english
Proyect of englishProyect of english
Proyect of english
 
Profe martha marilce
Profe martha marilceProfe martha marilce
Profe martha marilce
 
Ingles portafolio
Ingles portafolioIngles portafolio
Ingles portafolio
 
The stranger balanca
The stranger balancaThe stranger balanca
The stranger balanca
 
Pablo the stranger 200
Pablo  the stranger 200Pablo  the stranger 200
Pablo the stranger 200
 
The stranger.ppt niobe [recovered]
The stranger.ppt niobe [recovered]The stranger.ppt niobe [recovered]
The stranger.ppt niobe [recovered]
 
High ticket sales funnel #3 launch funnel
High ticket sales funnel #3 launch funnelHigh ticket sales funnel #3 launch funnel
High ticket sales funnel #3 launch funnel
 
High ticket sales funnel #2 webinar funnel
High ticket sales funnel #2 webinar funnelHigh ticket sales funnel #2 webinar funnel
High ticket sales funnel #2 webinar funnel
 
Quesflickr 091013022733-phpapp02
Quesflickr 091013022733-phpapp02Quesflickr 091013022733-phpapp02
Quesflickr 091013022733-phpapp02
 
Angular js
Angular jsAngular js
Angular js
 

Similar to Class 7 2ciclo

encapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloadingencapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloadingShivam Singhal
 
inheritance-16031525566nbhij56604452.pdf
inheritance-16031525566nbhij56604452.pdfinheritance-16031525566nbhij56604452.pdf
inheritance-16031525566nbhij56604452.pdfkashafishfaq21
 
oop database doc for studevsgdy fdsyn hdf
oop database doc for studevsgdy fdsyn hdfoop database doc for studevsgdy fdsyn hdf
oop database doc for studevsgdy fdsyn hdfitxminahil29
 
Inheritance and Polymorphism Java
Inheritance and Polymorphism JavaInheritance and Polymorphism Java
Inheritance and Polymorphism JavaM. Raihan
 
Lecture 6 inheritance
Lecture   6 inheritanceLecture   6 inheritance
Lecture 6 inheritancemanish kumar
 
Demystifying Object-Oriented Programming #phpbnl18
Demystifying Object-Oriented Programming #phpbnl18Demystifying Object-Oriented Programming #phpbnl18
Demystifying Object-Oriented Programming #phpbnl18Alena Holligan
 
Php object orientation and classes
Php object orientation and classesPhp object orientation and classes
Php object orientation and classesKumar
 
02-OOP with Java.ppt
02-OOP with Java.ppt02-OOP with Java.ppt
02-OOP with Java.pptEmanAsem4
 
INHERITANCE IN JAVA.pptx
INHERITANCE IN JAVA.pptxINHERITANCE IN JAVA.pptx
INHERITANCE IN JAVA.pptxNITHISG1
 
9781439035665 ppt ch10
9781439035665 ppt ch109781439035665 ppt ch10
9781439035665 ppt ch10Terry Yoast
 
Introduction to OOP with PHP
Introduction to OOP with PHPIntroduction to OOP with PHP
Introduction to OOP with PHPMichael Peacock
 
OOP Concepets and UML Class Diagrams
OOP Concepets and UML Class DiagramsOOP Concepets and UML Class Diagrams
OOP Concepets and UML Class DiagramsBhathiya Nuwan
 

Similar to Class 7 2ciclo (20)

encapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloadingencapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloading
 
inheritance-16031525566nbhij56604452.pdf
inheritance-16031525566nbhij56604452.pdfinheritance-16031525566nbhij56604452.pdf
inheritance-16031525566nbhij56604452.pdf
 
Segundo avance
Segundo avanceSegundo avance
Segundo avance
 
oop database doc for studevsgdy fdsyn hdf
oop database doc for studevsgdy fdsyn hdfoop database doc for studevsgdy fdsyn hdf
oop database doc for studevsgdy fdsyn hdf
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance and Polymorphism Java
Inheritance and Polymorphism JavaInheritance and Polymorphism Java
Inheritance and Polymorphism Java
 
Inheritance
InheritanceInheritance
Inheritance
 
Inheritance used in java
Inheritance used in javaInheritance used in java
Inheritance used in java
 
Lecture 6 inheritance
Lecture   6 inheritanceLecture   6 inheritance
Lecture 6 inheritance
 
Demystifying Object-Oriented Programming #phpbnl18
Demystifying Object-Oriented Programming #phpbnl18Demystifying Object-Oriented Programming #phpbnl18
Demystifying Object-Oriented Programming #phpbnl18
 
Unit3 part2-inheritance
Unit3 part2-inheritanceUnit3 part2-inheritance
Unit3 part2-inheritance
 
Inheritance in c++theory
Inheritance in c++theoryInheritance in c++theory
Inheritance in c++theory
 
Php object orientation and classes
Php object orientation and classesPhp object orientation and classes
Php object orientation and classes
 
02-OOP with Java.ppt
02-OOP with Java.ppt02-OOP with Java.ppt
02-OOP with Java.ppt
 
INHERITANCE IN JAVA.pptx
INHERITANCE IN JAVA.pptxINHERITANCE IN JAVA.pptx
INHERITANCE IN JAVA.pptx
 
9781439035665 ppt ch10
9781439035665 ppt ch109781439035665 ppt ch10
9781439035665 ppt ch10
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Introduction to OOP with PHP
Introduction to OOP with PHPIntroduction to OOP with PHP
Introduction to OOP with PHP
 
OOP Concepets and UML Class Diagrams
OOP Concepets and UML Class DiagramsOOP Concepets and UML Class Diagrams
OOP Concepets and UML Class Diagrams
 
Chap11
Chap11Chap11
Chap11
 

More from Carlos Alcivar

Gestor de proyectos_de_clase
Gestor de proyectos_de_claseGestor de proyectos_de_clase
Gestor de proyectos_de_claseCarlos Alcivar
 
Portafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 aPortafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 aCarlos Alcivar
 
Portafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 aPortafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 aCarlos Alcivar
 
Portafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 aPortafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 aCarlos Alcivar
 
Portafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 aPortafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 aCarlos Alcivar
 

More from Carlos Alcivar (8)

Gestor de proyectos_de_clase
Gestor de proyectos_de_claseGestor de proyectos_de_clase
Gestor de proyectos_de_clase
 
Class 6 2ciclo
Class 6 2cicloClass 6 2ciclo
Class 6 2ciclo
 
Class 4 2ciclo
Class 4 2cicloClass 4 2ciclo
Class 4 2ciclo
 
Class 1 y 2 2ciclo
Class 1 y 2 2cicloClass 1 y 2 2ciclo
Class 1 y 2 2ciclo
 
Portafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 aPortafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 a
 
Portafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 aPortafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 a
 
Portafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 aPortafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 a
 
Portafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 aPortafolio calculo diferencial 2 a
Portafolio calculo diferencial 2 a
 

Class 7 2ciclo

  • 1. Class 7 y 8  Exposure: Group #1 and Group #2 Group #1 INHERITANCE(Herencia) Allows the creation of new classes based on existing classes. When you inherit from an existing class, we reuse (or inherit ) methods and fields and add new fields and methods to meet the new situation. The existing class is called the super class or base class, or parent class. The new class is called subclass, derived class, or child class. Inheritance Hierarchy
  • 2. EXAMPLO Tipos de herencia Single inheritance · A class can inherit from a single Class. Example: Java, C # Multiple Inheritance · A class can inherit from multiple classes . · Classes form a directed acyclic graph Examples : Eiffel , C++
  • 3. Example 1.- package herencia; public class ClaseHeredada { String Apellido; public ClaseHeredada(String Dato) { this.Apellido=Dato;} } 2.- package herencia; public class Herencia extends ClaseHeredada{ String Nombre; public Herencia(String Texto){ super(Texto); } public void setPersona(String NombrePer){ this.Nombre=NombrePer+this.Apellido; } public String getPersona(){ return Nombre; }}
  • 4. Group #2 POLYMORPHISMS Is the ability of a class of objects respond to the same message or event based on the parameters used during its invocation .A polymorphic object is an entity that can hold values of different types during program execution . Classification  dynamic polymorphism  static polymorphism public class Articulo { private float precio; public void setPrecio() { precio = 3.50; } public void setPrecio(float nuevoPrecio) { precio = nuevoPrecio; } public void setPrecio(float costo, int porcentajeGanancia) { precio = costo + (costo * porcentajeGanancia); } }