Most voted "inheritance" questions
In object-oriented programming, inheritance is the system that allows objects to support operations defined by previous types without having to provide their own definition. She is the main vector for polymorphism.
Learn more…245 questions
Sort by count of
-
0
votes1
answer239
viewsHow to access inherited attribute in an entity with a query in Spring Data
Guys, I have the entity Client that extends Pessoa: @Entity @Table(name = "cliente") @PrimaryKeyJoinColumn(name="id_pessoa") @Document(indexName="cliente") public class Cliente extends Pessoa…
-
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
votes0
answers17
viewsUsing child class attributes
I have an object from the Account class "Account Lectured" however, using polymorphism daughter classes are assigned to Lectured. public AlterarLimites(Conta conta) { contaSelecionada = conta; type…
-
0
votes2
answers107
viewsHow do you inherit a pygame class?
When I run this code (this is the current entire code, ie only 3 lines): import pygame class sp(pygame.sprite): pass I get: Typeerror: module() takes at Most 2 Arguments (3 Given) I would like to…
-
0
votes1
answer268
viewsArraylist of Objects + Inheritance
All right guys I’m having a doubt about inheritance, for example: List<Carros> carros = new ArrayList<>(); Chevete chevete = new Chevete(); chevete.acelerarMuito(); //Até aqui ok…
-
0
votes0
answers319
viewsUse same parent table id in daughter - Hibernate
I’m having trouble setting up and treating the use of ID in parent/child classes using Hibernate. I get everything to work properly when the record does not exist in the parent table (records are…
-
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
votes1
answer40
views"super" and private variables
In the case below, it makes sense to call super() in class B_Class since the variable a of A_Class is private? It would be more feasible not to use the parent-class builder? Compiling this code…
-
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, 4 months ago MARCOS DAVID ALMEIDA DE SOUSA 3 -
0
votes0
answers24
viewsProblem with dynamic element creation
I am developing an application that uses a lot of Jquery, since there are several very specific functions. But for reasons of customization and optimization, I managed with the mix of some…
-
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
answer44
viewsWhy isn’t to_s being overwritten?
In Ruby you can override methods, even "default" language classes. I just wanted to know why the code I did below does not overwrite properly. class Oi end class Ola def to_s puts "Olá!" end end oi…
-
0
votes0
answers18
viewsWhy, in Java, should one prioritize the use of interfaces, rather than inheritance with classes?
I wonder why, in Java, one should prioritize the use of interfaces, rather than inheritance with classes.
-
0
votes1
answer179
viewsHandling of JAVA Attributes
Good afternoon, I’m with a college job and it’s the first semester I’m learning java. The job basically is: Make an interface that would represent any geometric figure, in it specify methods of area…
-
0
votes1
answer330
viewsHeritage Java web Inheritance
I have the inheritance to do below and would like to know how it would look on main. Someone here could help? Could you tell me if you have any problems with the mapping I did and how mainTeste…
-
0
votes0
answers249
viewsHow to use Pdo in php by making inheritance via composition?
I can’t think of the right structure to create application in PHP. At first I have the Person and Student classes. The Student class instances the Person class in order to use its attributes and…
-
0
votes1
answer573
viewsProblem calling base constructor in inherited constructor in C++
I’m taking data structures in college at C++ and this language is really crazy. I am trying to call the parent constructor in the constructor of the heirs classes, but the following error appears:…
-
0
votes2
answers275
viewsRelationship problem in the Mother Table (Inheritance) in Postgresql
I got the Mother Pay Table: CREATE TABLE pagamento ( pagcod serial not null, CONSTRAINT pk_pag PRIMARY KEY (pagcod) ) And the two daughter tables Cash and Credit Card: CREATE TABLE dinheiro (…
-
0
votes2
answers138
viewsC# conversion error
I have the most generic class Account and another ContaPoupaça who inherits from that class Conta. In this daughter I have an interface called ITributavel, because this class beyond the methods and…
-
0
votes1
answer526
viewsChange an attribute of a base class by the derived class C++
I’m having a problem involving inheritance in C++, I can’t change an attribute of a base class ex: // classe base class Base { vector(string) Names; //coloquei entre parenteses porque por algum…
-
0
votes2
answers438
viewsHow to add event to an inherited form event in Delphi?
I explain, I have Fmodelo1 that has several standard functions, among them I have the creation of the Oncellclick event of a Dbgrid that is inherited to all the Formularios created from Fmodelo1,…
-
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
votes2
answers292
viewsHow to use @Mappedsuperclass @Id with @Sequence Individual - Hibernate oracle
I need to solve a question of using inheritance and sequences with Hibernate and Oracle. I’m using Maven with: hibernate-core 5.1.5.Final hibernate-entitymanager 5.1.5.Final hibernate-validator…
-
0
votes1
answer236
viewsHow to solve this diamond inheritance problem
Can anyone solve this problem (diamond heritage) with the use of Interfaces and post here in c#? I found it in this post: Why C# does not allow multiple inheritances? but I couldn’t solve it.…
-
0
votes1
answer63
viewsQuery returns subclasses in Spring
I’m having trouble mapping the classes of a spring project I’m working on. I have the super class called Itempauta and the subclass Homologation. Pai Class @Data @Entity @Table(name="item_pauta")…
-
0
votes1
answer350
viewsDoes not contain a constructor that takes 0 arguments
My code is public partial class TelaInicio : MetroFramework.Forms.MetroForm { internal ExibirDados exibirdados = null; public TelaInicio(ExibirDados exibirdados) { InitializeComponent();…
-
0
votes2
answers485
viewsParent class array with two different subclasses
I created a program for the following exercise: Exercise: Do a program to register customers from an accountant’s company. It is important to store customer information such as name, address, phone…
-
0
votes2
answers224
viewsSave legacy data in C#
I have the following classes: public class Aluno { public String Nome { get; set; } public String Ra { get; set; } public Decimal NotaB1 { get; set; } public Decimal NotaB2 { get; set; } public…
-
0
votes3
answers60
viewsShorten Object Method Call
Recently I was doing college exercises, we’re seeing inheritance, and I made a code that generated many lines to demonstrate that class inheritance is working, there’s some way to shorten those…
-
0
votes1
answer50
viewsDoubt with exercise of Ecmascript 6
This Ecmascript exercise talks about the creation of two classes, one of user (where the email and password will be entered), the other of administrator (where in addition to the email and password…
-
0
votes2
answers28
viewsAccess Different Jframes objects (JAVA)
Good afternoon, Can someone help me with a project? I’m developing a simple vaccine system, but I’m having a hard time accessing attributes between a Jframe and another since in each Jframe I have…
-
0
votes0
answers29
viewsSET method does not modify vector attribute on object of a class
Follow the full code: // sistemafinanceiro.h #ifndef SISTEMAFINANCEIRO_H #define SISTEMAFINANCEIRO_H #include"banco.h" class SistemaFinanceiro { private: Banco banco; public: SistemaFinanceiro();…
-
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
answer33
viewsUsing Methodo within another Methodo with extends class
Hello, I’m learning PHP and I’m having a class inheritance problem. I have a class for connection and another for crud but I can’t use the connection in the crud class. someone can help me with the…
-
-1
votes1
answer81
viewsRead objects through the Scanner class
[![PHOTO OF THE CODE][1]][1] I am not able to instantiate an object and read it with the method of the Scanner class. It is possible to do something like? Scanner s = new Scanner (System.in); Notas…
-
-1
votes1
answer34
viewsFailure to update variables
I am developing a project in java, a "farm game" where there are several Tats for the character that is created. When we create a character defenimos which his class, it will influence his Stats. My…
-
-1
votes1
answer263
viewsInheritance with Typeorm
There are common problems that I see a lot of difficulty to deal with Orms, and ignoring a native way I decided to ask what is the best way to deal with these using Typeorm in project. Today I have…
-
-1
votes1
answer54
viewsIs it possible to inherit a limited set of methods from a super class in Python?
I would like to build a class that inherits only a few methods from the mother class, but not all. To understand what I mean, suppose I have two classes, Person and Student: class Person: def…
-
-2
votes1
answer80
viewsDoubt in inheritance c#
I have a conceptual doubt about inheritance, where I have a student and at some point this student will become an employee and this employee he was born in the system as a student and if everything…
-
-2
votes1
answer49
viewsHow to implement the DAO standard in subclasses?
I’m developing an app that’s a gun store. I own the class Produto with the subclasses Arma, Faca and Municao. In this project I am applying the DAO standard, but I don’t understand very well how its…
-
-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',…
-
-2
votes1
answer66
viewsStack overflow exception being generated in the instance method "Equals()"
I created a class called MyList<T>, with the intention of reproducing the class List, and I overwrote the method Equals to compare your instance with another of the same class, as follows:…
-
-3
votes1
answer202
viewsObject Orientation in C# - Inheritance
In relation to Orientação Objeto in the C#, have the following doubt: What is the difference between the inheritance of code reuse, of builders, of abstract methods, of superclasses and of…
-
-3
votes1
answer66
viewsDOUBT OF INHERITANCE IN JAVA(SMALL)
You were hired to develop a system for a motorcycle workshop, cars and trucks. Your first task will be to build a set of classes for represent the vehicles that will be met in the workshop. having…
-
-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;…