Questions tagged as 'polimorfismo'

1
answer

Polymorphism in Java

Example: // Super classe: Carro abstract public class Carro { String nome; public void andar(){ // anda } } // Sub classe: Fusca public class Fusca extends Carro { public void andar(){ super.andar();...
asked by 13.01.2015 / 16:59
1
answer

When to use Supertype or Subtype on return method?

Suppose I have a method called " meuMetodo() " that returns an Object of type ArrayList<String> , I can make this method declare that it returns more concrete or more abstract types:    public ArrayList<String> meu...
asked by 10.05.2017 / 22:08
1
answer

Is it incorrect to change the arguments in an extended classes in PHP?

Is it incorrect (or "semantically incorrect") to change the arguments in an extended classes in PHP? For example I created this class: class Bar { public function __construct($message, $code, $timer) { var_dump($message, $co...
asked by 30.12.2016 / 23:00
2
answers

Instantiating an Object with a Different Reference

I am learning Polymorphism in Java, but I have some doubts. public class Animal { int numPatas; public void fazerBarulho() { // Código do Método } public void comportamento() { // Código do Método } }...
asked by 20.07.2014 / 21:23
1
answer

Overlay polymorphism is required?

In overlapping polymorphism is it mandatory that the method of a parent class that will be superimposed on a subclass is abstract? Is there an exception for some OOP language?     
asked by 04.01.2018 / 17:48
1
answer

Method overload is polymorphism?

I'm having trouble understanding the concept of polymorphism in Java, I've read two articles from the same portal now, and got confused more, because for my interpretation they contradict each other: Excerpt 1:    "Overload is a concept of...
asked by 27.06.2018 / 03:40
2
answers

How to adapt / create a method that receives an anonymous class in C #

I have a method in which one of the parameters is an object of an abstract class - ObjectMapper - whose purpose is to convert an object from one class to another from another class. Below, the method signature informs that the objectMapper will...
asked by 17.09.2015 / 17:04
1
answer

Can a list of a type not be a list of its 'top' type?

There are some entities in the application I'm developing that need to be sorted by a predefined routine. Thinking about this has created a contract class called ElementoOrdenavel and all entities that can be ordered inherit from thi...
asked by 21.06.2017 / 21:05
3
answers

Method returning parent class to child class

I have the following classes: public class Pessoa { public int PessoaId { get; set; } public string Nome { get; set; } public DateTime DataNascimento { get; set; } } public class Cliente : Pessoa { public int ClienteId { get;...
asked by 27.06.2016 / 20:35
2
answers

How to change the way in which a class / structure is printed?

I have the following structure: struct cores { int r, g, b; public cores(int r, int g, int b) { this.r = r; this.g = g; this.b = b; } } If I have a new structure printed, it looks like this: Consol...
asked by 10.09.2017 / 03:05