Most voted "polymorphism" questions
It is the feature that allows rewriting methods in the base classes so that a method can behave differently in different classes.
Learn more…70 questions
Sort by count of
-
1
votes1
answer1846
viewsJava Academic System
Hello. I need help to build a Java program with the following specifications: 1) Read, from the user, the following items: Name(String), Age(int), gender(char[M or F]), telephone(String),…
-
1
votes1
answer2329
viewsJava creation of Register
I am creating an academic system in Java, but I have a problem. I have 4 classes (Principal, Pessoa, Aluno and Professor). I believe it is something simple, the error that appears is in the class…
-
1
votes1
answer141
viewsMenu with Polymorphism
I’m creating some examples to learn polymorphism more deeply, but in the original code, all functions work correctly. Original code: #include <cstdlib> #include <iostream> class Mamifero…
-
1
votes0
answers212
viewsInheritance attributes using abstract class
I’m looking to use inheritance with parent class being abstract. The point is that I’m using the toString() superscript so that each print of child classes can print their respective data. But when…
-
1
votes1
answer1225
viewsPolymorphism with interface and abstract class
How do I make a method defined on the interface iDAO is passed on to be implemented by the class ProprietarioDAO, daughter of the abstract class absDAO, implementing iDAO? import { EntidadeDominio }…
-
1
votes0
answers17
viewsTable structure with polymorphy
I am developing a CRM and I am in doubt in the structure of the tables, I do not know exactly what is the best way to follow to not have performance problems and also not mix the data, I ended up…
-
1
votes3
answers103
viewsAm I doing polymorphism the right way?
I have a major sales class, and other subclasses that would inherit the sales class. I thought of using polymorphism, in addition to using common methods as inheritance, I thought of injecting…
-
0
votes1
answer170
viewssubclass does not incorporate super class method
This is the first time I’ve had this mistake. I have the Class Loja that extends into several subclasses. problem is that subclasses do not "ask" the super method Shop: public abstract class Loja {…
-
0
votes1
answer100
viewsMethod superscript applies to all class hierarchy?
When there are several extends (as in the example below) all methods are overwritten to the last extends? If not, which method will be used? class D extends C { void x() { System.out.println(1); } }…
-
0
votes1
answer110
viewsWhy is one method that uses polymorphism being called in place of another in case of inheritance?
Could someone explain why the output of the program is: Primate walking Mammal listening Man seeing. Shouldn’t be?: Primate walking Mammal listening Mammal selling Year: 2019 Banking: IDECAN Organ:…
-
0
votes2
answers333
viewsWhat is and what is an override (method override) for in programming?
The title of the question basically says it all: what is and what is a Override (method envelope) in the programming?
-
0
votes1
answer95
viewsIn Java, getter and abstract Setter is correct?
I have an abstract parent class Usuario. And a daughter class Usuario_Adulto. The attribute idade is in the abstract class Usuario. To validate it I made a method Setter abstract in the parent…
java inheritance polymorphism abstract-classesasked 4 years, 8 months ago MARCOS DAVID ALMEIDA DE SOUSA 3 -
0
votes0
answers10
viewsIn what cases should we use the concepts of inheritance and polymorphism, and what are the benefits?
In what cases should we use the concepts of inheritance and polymorphism, and what the benefits ?
-
0
votes1
answer483
viewsInheritance, polymorphism and access to methods
I have 3 classes and 1 enum: public class Pessoa { private TipoPessoa tipo; public TipoPessoa getTipo() { return tipo; } public void setTipo(TipoPessoa tipo) { this.tipo = tipo; } } public class…
-
0
votes0
answers16
viewsJava - Interface
I was studying interface and I came up with a question in the code below: public class TesteGerente { public static void main(String[] args) { Autenticavel referencia = new Cliente(); Gerente g1 =…
-
0
votes1
answer49
viewsDoubt about polymorphism
Hello, good afternoon, I have a question related to polymorphism. Suppose I have an object Casa implementing Imovel where Imovel has a method getValorIptu() and House has an attribute…
-
0
votes1
answer27
viewsPython Django heritage with Unique attribute
I’m in a little trouble. class Pessoa(models.Model): cpf = BRCPFField(**unique=true**) class Aluno(Pessoa): novo_atributo = .... class Instrutor(Aluno): outro_atributo = ... class Gestor(Pessoa):…
-
-1
votes1
answer54
viewsDoesn’t Arraylist accept Overload Polymorphism?
I am trying to overload the add method, but apparently this does not work with Arraylists. Confirm? Métodos: public int somar(ArrayList <Classe> classe){...} public int…
-
-2
votes2
answers832
viewsInheritance and polymorphism in python
from random import randint class Nomes(object): def __init__(self, qtd_letras): self.letras = qtd_letras self.alfabeto = (('A', 'E', 'I', 'O', 'U'), ('A','B', 'C', 'D','E','F','G','H','I','J','K',…
-
-3
votes1
answer223
viewsAccess toString method from generic class
I have a generic class Official and other 3 specific classes that inherit from employee. Within the Employee class, I have the method toString. abstract class Funcionario { private String nome;…