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
- 
		1 votes2 answers80 viewsUse get_object_vars in a child classI got the following class: class Dominio { private $teste; public function getAtributos() { return get_object_vars($this); } } And other classes that inherit it it(Dominio): class ClasseQualquer… 
- 
		1 votes1 answer1531 viewsHow to use more than one extends?When I create the project it comes like this public class MainActivity extends AppCompatActivity{ would like to use more of a extends how to do ? import android.support.v7.app.AppCompatActivity;… 
- 
		1 votes3 answers450 viewsAccess modifier protectedA common class (which is not subclass) and has no inheritance, can use an attribute protected of a superclass that has a subclass? If so, this attribute will be visible (no need to use the… 
- 
		1 votes1 answer89 viewsInheritance in RailsI’m starting in the area, I have the following scenario in my back end done in Rails: I want to implement a parent class: Equipment: PK ID Brand ... And some child classes Printer: ID_EQUIPAMENTO PK… 
- 
		1 votes1 answer38 viewsIn this case below, wouldn’t the login attribute have to be set as private for the method?I am studying inheritance in Java and one of the exercises has the code below, I think, the login attribute would not have to be set as private for the method? public class Gerente extends… 
- 
		1 votes1 answer262 viewsConstructor method in inheritance classesUsing Python3, as would the constructor method of the class Z? class W: def __init__(self, atributo1): self.atributo1 = atributo1 def metodo1(self): print("Metodo1") class X(W): def __init__(self,… 
- 
		1 votes1 answer69 viewsHow to pass the class (Teste2 teste2) as reference in the ("super") C++ constructor?On the basis of that reply In C++ what command corresponds to super() of Java? Class Teste2{ int x; int y; public: Teste2(int x, int y){ . . . } } class Testando{ Teste2 *teste2; public:… 
- 
		1 votes2 answers261 viewsInheritance in the Entity FrameworkI am now reading about cross domain inheritance in EF. I came across this example: public abstract class BillingDetail { public int BillingDetailId { get; set; } public string Owner { get; set; }… 
- 
		1 votes0 answers92 viewsHow to make inheritance with Javascript / jQueryI have a question about how to use inheritance with Javascript / jQuery (if possible), I did a search but found confusing materials of gringos who could not help me. Let’s go to the classic example… 
- 
		1 votes1 answer139 viewsUse of delete Function - Inheritance of a QlistWhen compiling I get the following error, in Qlist. I’m using Qt 5.6. error: use of Deleted Function 'Vitamin::Vitamin(const Vitamin&)' Current->v = new T(*reinterpret_cast(src->v));… 
- 
		1 votes2 answers849 viewsCatch instance of daughter classI have a class: class Children extends Database Soon, Children is the daughter class and Database the parent class, in the parent class I have the attribute: protected $object = null; The value of… 
- 
		1 votes1 answer84 viewsAre inheritance derived classes different tables in Mysql?If I use inheritance and have 4 derived classes and my parent class is abstract, these 4 derived classes will each have a different table in the Mysql database? 
- 
		1 votes1 answer1846 viewsJava Academic SystemHello. 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 RegisterI 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 answer126 viewsInheritance problem with HIBERNATEWell, my problem is this, I have an abstract class Official and two subclasses Attendant and Dentist inherited. I also have a class User, which has as attributes login, ... , .... , ... and an… 
- 
		1 votes3 answers347 viewsForm Inheritance created in RuntimeFollow the code below: type TfObject = class(TForm) private procedure FormShow(Sender : TObject); procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure… 
- 
		1 votes1 answer112 viewsHow is the signature check of the super functionThe function super() serves to call the parent builder and verify suitable signatures. public class Pessoa { private String nome; private String endereco; private String telefone; private String… 
- 
		1 votes1 answer69 viewsHeritage Mapping Type per Type Asp.NetIn my project, I have a type of heritage that I have mastered by TPT. Analyzing the documents and several examples I can’t identify where I’m going wrong, because the mapping is apparently correct,… 
- 
		1 votes2 answers3232 viewsAssign one class to another in C++There is a class as below: class vetor { protected: int x, y; public: //Construtor vetor(int _x=0, int _y=0); }; and another: class pos : public vetor { public: //Construtor pos();… 
- 
		1 votes1 answer294 viewsImplementing the concept of inheritance in a databaseWhy the attribute PessoaJuridicaId is not generated? This is the base class Pessoa: public class Pessoa { public Pessoa() { DataCadastro = DateTime.Now; } public int PessoaId { get; set; } public… 
- 
		1 votes0 answers45 viewsMy class "Playerbehavior" is not inheriting the other class "Characterbase"I’m not getting access to the class CharacterBase of my Script PlayerBehavior using System.Collections; using System.Collections.Generic; using UnityEngine; public enum TypeCharacter{ Priest = 0,… 
- 
		1 votes0 answers212 viewsInheritance attributes using abstract classI’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 answer288 viewsI have a question about inherited default buildersI am doubtful when trying to improve a POO exercise here.. (-) = without I have the PAI class with two constructors (one is default). In the FILHO class I have two more constructors (no-default). In… 
- 
		1 votes1 answer82 viewsClasses with operations extending another classI have a class called cliente class cliente { private $id; private $nome; function getId() { return $this->id; } function getNome() { return $this->nome; } function setId($id) { $this->id =… 
- 
		1 votes3 answers110 viewsHow to call the same method with different arguments but inherited from the same mother class?I have two classes (ColunaDoGrafico and ColunaDoRelatorio) extending from Coluna. My Column class has the following structure: public class Coluna { protected String tipoFiltro; protected boolean… 
- 
		1 votes2 answers165 viewsCalling the method of a specific superclassSuppose I have the following hierarchical structure in Java: First a class Avo: public class Avo { protected String nome; public void falar() { //Codigo aqui } } Next I have a class Pai who inherits… 
- 
		1 votes1 answer942 viewsHow to access parent class attributes in PHP?How do I access the parent class attributes once I instated the child? Direct access $Filho->atributoPai doesn’t work. Access by function $Filho->getterPai doesn’t work. For every inherited… 
- 
		1 votes1 answer177 viewsInheritance class: error TS2554: Expected 5 Arguments, but got 0I have two classes in Angular 4 that are related by inheritance, however in doing the build makes a mistake: error TS2554: Expected 5 Arguments, but got 0. Pai Class: constructor(protected http:… 
- 
		1 votes2 answers104 viewsUse/change property of an extended class and print by instanceExample scenario Root folder Classea.php Classeb.php index php. Filing cabinet: classeA.php class ClasseA { public $retorno = null; public $error = "Erro desconhecido"; function __construct { $this… 
- 
		1 votes1 answer260 viewsUpcasting and DowncastingI know that Upcasting is to convert a subclass object to the superclass and Downcasting is to convert a superclass object to the subclass. But in relation to the loss of values and the like, as it… 
- 
		1 votes0 answers12 viewsEmbedding blocks into other blocks is not supportedI have developed a Volt template and intend to use it as a default for others. There is an example of my code below: {# LOCKED MODE #} {% if session.get('locked_mode', true) is not empty and… 
- 
		1 votes0 answers32 viewsHow to deal with Scala x Java classcastingI’m having a problem working with heritage between Scala and Java. To contextualize, follow an example that reflects my problem. Java Class public class Animal { } Java Class public class Cat… 
- 
		1 votes2 answers245 viewsHow to make a Class property of another Class? C#I am doing a job of the facul that is for control of fleet of vehicles, I created a class Travel and I tried to put the classes Driver and Vehicle in this class. public Motorista {get; set;} public… 
- 
		1 votes1 answer163 viewsChange super class value using subclass methodThe method sacar() does not work, does not change the value of the balance. I make the deposit using super class method ContaBancaria direct, the sacar() is of class ContaPoupanca that extends the… 
- 
		1 votes1 answer143 viewsWhat is the need to declare the constructor/super of an extended class?I have a class, example: class Animal { constructor(raca) { this._raca = raca; } get raca() { return this._raca; } printRaca = function() { console.log(this._raca); } } And then I extend it this… 
- 
		1 votes2 answers77 viewsIf an A class is an implementation of an X interface, will the subclasses of A also be?With the interface Posicionavel: package projeto; public interface Posicionavel { public boolean mesmaPosicao(Posicionavel p); public boolean mesmaPosicao(int[] x); public int[] posicoes(); } And… 
- 
		1 votes1 answer50 viewsIs it possible to create a Java superclass for basic CRUD functions using spring framework?While working recently on a project, I noticed that we have several classes with basic CRUD and repeating functions, their only differences, would be some parameters, responses and function calls in… 
- 
		1 votes0 answers141 viewsInterface and heritage in Xamarin - System.Invalidcastexception: Specified cast is not ValidGreetings! I’m developing a Cross Platform project in Xamarin. This project consists of consuming a web-service method that will return the script code and an address array that corresponds to the… 
- 
		1 votes1 answer53 viewsHow to access mother class fields through inheritance?Simplifying what I mean, suppose I have a Mother class: public class Mãe { private String nome; // Declarando o campo privado nome public Mãe(String _nome) { nome = _nome; // Definindo o campo nome… 
- 
		1 votes2 answers103 viewsMemory organization when there is inheritanceWhen I declare funcionario as Pessoa in the main(), where the attribute value "goes" to salario, since the class Pessoa does not have that attribute? public abstract class Pessoa { private String… 
- 
		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 votes2 answers1147 viewsHow to Inherit Models in Laravel 4Whereas you have the Models Pessoa and Usuario, and that a Usuario is a Pessoa (Usuario extends Pessoa), or Usuario belongsTo Pessoa and Pessoa hasOne Usuario. It is possible that the Usuario has… 
- 
		0 votes1 answer643 viewsPopular C# datagridview with inheritance classGood people, I have the following situation: public class TiposMateriais { public int tipoCodigo { get; set; } public string tipoDescricao { get; set; } } public class Materiais { public int… 
- 
		0 votes1 answer356 viewsVisual Heritage of Windows FormI am making a base form with all the components I need to perform a CRUD, and for example, when I create the customer registration form, I will inherit the base class and so show up all the basic… 
- 
		0 votes3 answers2201 viewsHow one class can inherit from one interface and another class in DelphiI’m creating a small persistence class using RTTI. I created the attributes of fields separated by type Ex: Fieldstring[], Fieldinteger[] and etc.. At a certain point I need to go through the… 
- 
		0 votes2 answers86 viewsChange type of returnHow do I change the return type of a mother class function in the daughter class? For example: class Mother { public: void Get() {} }; template <typename Type> class Child : public Mother {… 
- 
		0 votes0 answers166 viewsCreate an object instance by Activator.Createinstancefrom C#I need to instantiate the Paismapper class with the following scenario. DLL running: Projeto.ERP.Desktop In Formuláriopal I execute the method… 
- 
		0 votes2 answers425 viewsClass association or inheritance?What better way to create an association or heritage where I have the class User and the class Academic whereas Academic is a User User-class: public class Usuario { public int Id { get; set; }… 
- 
		0 votes3 answers1127 viewsHow to add Toolbar in Activity without inheriting Appcompatactivity - Android Studio 1.4Good night. I updated my Android Studio for version 1.4 and by default, any activity used as an inheritance to AppCompatActivity (public class MainActivity extends AppCompatActivity). I developed an… 
- 
		0 votes0 answers640 viewsHow to use super in java?I know the basics of super, but for example : If I have a class mae Person with attributes name, age and sex, and a class daughter Student with attributes course, enrollment and period, and a class…