Most voted "oop" questions
Object orientation is a paradigm of analysis, design and programming of software systems based on the composition and interaction between several units of software called objects.
Learn more…1,456 questions
Sort by count of
- 
		5 votes3 answers1022 viewsYou’re a builder, right?I’d like to understand why this class has two builders and why one of them has everything in it this and not separated as in the other. This changes something? Normal builder: public… 
- 
		5 votes2 answers396 viewsHow to play relationship in Objects?According to the definition of this website: CARDINALITY Is the maximum and minimum number of occurrences of an entity that are associated with the occurrences of another participating entity… 
- 
		5 votes1 answer1351 viewsMultiple inheritance and diamond problemWhat’s wrong with the diamond? How do languages treat it? And they treat themselves differently because there is this difference? 
- 
		5 votes2 answers84 viewsWhy does the new instance of Actionlistener receive a parenthesis and a ;(semicolon) at the end?I’ve never seen this kind of code structure in the instance, what does it do? The class ActionListener To instantiate it, you have to put it like this: ActionListener trataEventos = new… 
- 
		5 votes2 answers419 viewsIs it possible to instantiate a class without storing it in a variable?Normally I do so: $a = new MinhaClass($Parametro); You can do this without creating the variable $a ? Only with the new? 
- 
		5 votes1 answer157 viewsIs overlapping polymorphism mandatory?In overlapping polymorphism is it mandatory that the method of a mother class that will be superimposed on a subclass be abstract? Is there an exception for some POO language? 
- 
		5 votes1 answer105 viewsBuild Data Frame with "get" FunctionThis is my date.: data<-read.csv2("NewEXEMPL.csv",header=TRUE,sep=";") head(data,5) DATE P.A i.A S.A w.A b.A P.B i.B S.B w.B b.B P.C i.C S.C w.C b.C 1 jun/79 16.86 59.67768 12.3125 0.4291845… 
- 
		5 votes2 answers1026 viewsCan a subclass have two superclasses?Suppose I have a superclass Pessoa and another Funcionário, with its certain attributes and methods. My class Professor may be "daughter" of Pessoa and Funcionário, once it fits both? If yes how is… 
- 
		5 votes1 answer759 viewsPHP with DAO + mysqliDAO necessarily needs to be a class? Or I could create methods within a file. php without encapsulation of a class? If not possible, what is the name of the classless DAO (name of some pattern equal… 
- 
		5 votes1 answer346 viewsWhen should I instantiate a class?I’m having second thoughts about the best time to call for instantiate a classe. Should I do it at the beginning, before the builder, at the constructor or at the time when we will make use of some… 
- 
		5 votes2 answers908 viewsWhat is the real PHP interface utility?I know what interface is used as a common pattern. But it doesn’t seem useful. Because what good it is to create an interface that only has the name of the methods? I have to encode each of them in… 
- 
		5 votes3 answers148 viewsVariable is not updated in constructorI’m learning OO and venturing into PHP, only I came across something that I think in theory should work, but in practice does not work. <?php class Users{ public $name; public $idade; public… 
- 
		5 votes1 answer122 viewsInheritance at compilation time?I was reviewing some codes and some concepts when I find the following assertive: The legacy mechanism in Java occurs at compile time, i.e., every reuse of code accomplished by inheritance is… 
- 
		5 votes1 answer112 viewsIs it prudent to use several paradigms in a C++ project?Would it be advantageous to use several paradigms in a project in C++? For example, in a certain part of the code I use reactive Programming, in other parts I use OOP, and in other parts I use… c++ oop encoding-style functional-programming paradigmsasked 6 years, 11 months ago Strawberry Swing 177
- 
		5 votes1 answer56 viewsIs it possible to reuse domain classes between different applications?Some materials including recent cite the possibility of reusing domain classes for different applications. Example This reuse is viable? How he does in practice?… 
- 
		5 votes1 answer1382 viewsWhat is the advantage of using an interface if I always get the same behavior using simple classes in Delphi?First of all, I want to point out that this issue DOES NOT ADDRESS comparison between abstract classes and interfaces, it aims to find out if there is any advantage in using interfaces to the… 
- 
		5 votes1 answer143 viewsWhy are instance variables usually initialized in the constructor?I have seen several codes where the instance variables of a class are initialized in the constructor, even I do it myself by watching others do it. But I never understood it. Logical that has the… oop variables software-engineering builder initializationasked 5 years, 11 months ago NinjaTroll 1,752
- 
		5 votes1 answer516 viewsWhat is the difference between an Entity and a Model (MVC and the like)?In object orientation both are classes usually used to represent something that will be persisted (not that it is mandatory to persist), but what is the difference between them? Or are they… 
- 
		5 votes2 answers134 viewsWhen do I need to use a class that inherits from an Arraylist of a kind? I don’t understand what that’s forExample: public class ListaAdapterItem extends ArrayList<Item>{ } And I got a class Item: public class Item { private int imagem; private String nome; private String descricao; public Item(int… 
- 
		5 votes1 answer92 viewsWhy are certain domains easier to model than others?I have heard about certain domains, such as Guis and games, which are more "abstracted", or are already abstractions, or are "mechanisms", in short, have a distinction in relation to other domains.… 
- 
		5 votes2 answers4088 viewsGetters and Setters MethodsIn my course, I’m learning getters which takes "data" and setters, inserting/modifying. I made my code like this for the pen class: <?php class Caneta { public $modelo; private $ponta; public… 
- 
		5 votes1 answer77 viewsHow to solve the code duplication problem?In Wordpress I am creating a custom screen in the administration area. That’s why I’m extending my class customProductsListTable the class WP_List_Table: class customProductsListTable extends… 
- 
		5 votes1 answer117 viewsIs it bad practice to use an "optional" variable inside an object?When I download a photo on my system, the download process goes through a security method that returns me an object called DownloadResponse. public class DownloadResponse{ public bool IsValid{get;… 
- 
		5 votes2 answers410 viewsPrivate class in JavascriptI’m looking for a way to make both attributes and methods invisible so they’re not accessible from outside the class. But I also wanted to use the modern approach to do this (class Nomeclass{}).… 
- 
		5 votes1 answer150 viewsCase of use of the SRP concept in a real applicationI’m studying some concepts of OOP and I see a lot about the issue of SRP, "separating actions into classes etc". at the level of testing, I decided to create a small system for registering users in… 
- 
		5 votes1 answer3676 viewsWhat are software components?"Component" is a word used in various contexts and I imagine that it is difficult to define generically. By definition it is a part that makes up a whole. For example, a subsystem. It is also said… 
- 
		5 votes1 answer239 viewsWhere are the objects created in Python stored?I made a little script to record student data where I work. I can instantiate it and I can see the data right after. But, after leaving the program, this data is lost. Are these objects only stored… 
- 
		5 votes1 answer78 viewsA method can access the properties of the object it belongs to when stored through a delegate?I’m building a dictionary of the following kind: <string, delegate>, that will access a method belonging to an object of the following class: class Example{ public int Power { get; set; }… 
- 
		5 votes3 answers232 viewsHow to overlay a superclass method using a polymorphic parameter?I have an abstract superclass Service with an abstract method onExecute(ServiceData data) that is superimposed in the subclass EchoService. However, in this overlaid method, I need the parameter to… 
- 
		5 votes1 answer106 viewsIs an executable in imperative programming language smaller than an executable in object-oriented language?Well, that is, usually object-oriented programs have several calls to small methods for passing messages, encapsulation is also a common consequence of the model, not to mention polymorphism and… 
- 
		5 votes1 answer138 viewsUntreated POO code exception (Get and Set) from C#The code in question is used to calculate the circle area value using keywords get and set. After I occurred CS1729 error a constructor was created to fix it private double valor; public… 
- 
		5 votes1 answer109 viewsDoubt about generic types in TypescriptI am currently studying Typeorm, and wanted to create a generic controller, as it will always be the same CRUD operations. I know I can solve with native Typeorm solutions, such as getRepository(),… 
- 
		4 votes2 answers1232 viewsDifferences when instantiating a classUsing the PHP when instantiating an object I do it as follows: $obj = NEW my_class_exemplo; but always the netbeans auto complete gives me the option to put parentheses like this: $obj = NEW… 
- 
		4 votes2 answers144 viewsHow to make a constructor equal to Qobject?When a new question arises from an old question, I want to know how to create a class equal to QObject. Basically, I want to know: How to make a copy constructor that does not accept "assignment… 
- 
		4 votes2 answers117 viewsDoubt object orientation + java ORMI am wanting to store the data of my program via ORM and am separating cute each object. My User object, for example, has its basic attributes and is also composed of other objects such as Address,… 
- 
		4 votes1 answer187 viewsClass protected and publicWhat is the behavior of a protected class? What is the impact of access modifiers (especially private and protected) on classes, and what are their common uses? I can understand its functionality… 
- 
		4 votes3 answers28540 viewsCreate an array with objects in JavascriptI have defined the object, and the array in the scope. //Define o array que deve ser preenchido com os objetos var itensList = []; //Define os argumentos do objeto var oItem = { Codig: 0, Desc: "",… 
- 
		4 votes1 answer161 viewsInheritance with interfaceHow could I solve the following problem. Setting: I have a class B that inherits from class A and implements interface I. Problem: The I interface requires the implementation of the X method which… 
- 
		4 votes4 answers4106 viewsInstantiate class as another class’s PropertyI have two classes created within the same namespace, being: public class Pessoa { public int idPessoa { get; set;} public string nome { get; set;} } public class PessoaFisica { public Pessoa pessoa… 
- 
		4 votes1 answer139 viewsHow to restrict inherited types from a hierarchy level?Given the hypothetical model below: public abstract class Veiculo { public Motor Motor { get; set; } } public class Aviao : Veiculo { } public abstract class Motor { } public class MotorCarro :… 
- 
		4 votes2 answers490 viewsHow to persist the status of a queue of requests?I am working on a C# application that requires a row of items of the type Pedido. Basically whenever a new order is created it is queued and the application shows the orders in sequential order that… 
- 
		4 votes1 answer875 viewsEntity Framework auto relationship enable cascading deleteHow to create a cascading deletion, in a self-relationship using the fluent api and enable this in entity framework? Code: Public class Usuario { public int UsuarioID { get; set; } public int?… 
- 
		4 votes3 answers10588 viewsGlobal variable in all functions of the classUsually when I want to pull a variable that is out of class, I use global $variavel, but wanted this variable to be accessible in all functions of the class, not to be needing to "pull" in all… 
- 
		4 votes2 answers729 viewsPOO tables in Lua!I wonder why it is not returning a table in the code I made: TP = {} function TP:new(pos, newpos, effect) return setmetatable({pos = pos, newpos = newpos, effect = effect}, { __index = self }) end… 
- 
		4 votes2 answers887 viewsCan I use a variable to overwrite a method?When rewriting a method, in PHP, I can use a variable to receive the method? I did the example below and it worked normally, but I don’t know if this is correct or if it is the best way to rewrite a… 
- 
		4 votes1 answer282 viewsIs sending parameters to another function using object or hash a good practice?Exemplo: function atualizar(dados, events) { //faz qualquer tratamento dos valores var hash = { novoValor: dados, outroValor: event }; // primeira opção return customize(dados, event); // segunda… 
- 
		4 votes4 answers257 viewsUse of setters in the builderI wonder if there’s any difference, semantically speaking, between these two builders: public Aluno(String n, float n1, float n2) { this.nome = n; this.setNota1(n1); this.setNota2(n2); } and public… 
- 
		4 votes4 answers7150 viewsIn inheritance with private attributes, does not the daughter class take its attributes from the mother class?The devmedia article says the modifier private does not give access to its attributes in its child classes. It has a table with modifiers. In inheritance with private attributes, the daughter class… 
- 
		4 votes2 answers505 viewsCalling protected variable inside static method<?php class Foo{ protected $calc; function __construct(){ $this->calc = 2; } public static function getCalc(){ return $this->calc * 5; } } Foo::getCalc(); When I spin, he gives me that… 
- 
		4 votes3 answers161 viewsWhat is the difference between these 2 PHP codes?I am studying PHP and came across the following question: what would be the difference between the following codes: <?php class ClasseTeste { protected $db_host = 'localhost'; protected $db_user…