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
-
1
votes0
answers297
viewsWhat does Trying to get Property non-object mean
I’ll explain my problem I am working with an API and in this api I am getting a certain fields(codigo,ncm,gtin,origin,codigo_pelo_vendor) so my idea was to use a foreach in this way foreach…
-
1
votes0
answers21
viewsObservers can be injected into the observable?
It’s a half-ass question whose answer might be "make the most sense of the code," but it doesn’t hurt to ask. The pattern Observer suggests that an observer register (via…
-
1
votes0
answers49
viewsTwo observable watching each other? Or something different from that?
Consider a class ServidorTcp (I don’t know if this is the right abstraction; it would have two operations, iniciar() and parar()). Inside there’s a field socketServer whose type is SocketServer (a…
-
1
votes1
answer717
viewsService, Model and Repository: where should logic, validations and possible external communication be?
I’m doing a small project for learning purposes using Laravel, this system revolves around two "models", Conta and Transacao. one Conta has name and balance, a Transacao has count_source,…
-
1
votes0
answers1019
viewsAttributeerror: 'Nonetype' Object has no attribute 'saldoConta'
I’m starting my POO studies with python and I took a class test ContaBancaria very simple, whose methods would only be withdrawal and deposit. But when I interact with the user, I can’t assign the…
-
1
votes0
answers12
viewsCompilation error, Exception in thread "main" java.lang.Arrayindexoutofboundsexception: 0
Compiler points out the following error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 Just after points to the if line public class Pilha extends Lista { public Pilha(int…
-
1
votes0
answers27
viewsDifficult to understand how eventlisteners work in Java?
Greetings dear fellow programmers Are you all right? I hope so I’m doing this publication because I’m having a lot of difficulty to understand a specific parameter of the listeners of Android…
-
1
votes2
answers133
views.Net Core 3.1 - How to use Enum to replace code string
Separate file: public enum LANG { NOT_SET = 0, ENGLISH = 1, PORTUGUESE = 2 } File in which I want to put Enum that is currently being validated with string: public bool Validate(StructuralData data)…
-
1
votes1
answer2372
viewsArray and string offset access syntax with Curly braces is no longer supported
how to correct this error? Fatal error: Array and string offset access syntax with Curly braces is no longer supported in C: xampp htdocs POO 03 - METHODS STATIC example-03.php on line 64 the code:…
-
1
votes2
answers67
viewsIs there a better way to deal with relational and non-relational databases in the same project?
I am refactoring a code, where I process some data and send it to a database. I have two versions. One where I use Mongodb and the other where I use Mysql. But I’d like to put the two versions…
-
1
votes2
answers103
viewsMemory organization when there is inheritance
When 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
votes0
answers40
viewsC++: Add an integer variable in an ordered way in a list
I need to add integers in an orderly way, within a list implementation that I developed. //Implementação dos nós para serem usados na lista NodeList::NodeList(int dataa){ this->next = NULL;…
-
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…
-
1
votes1
answer28
viewsWhy do I still have access to the current state of the object in this case? [EXAMPLE C#]
A very basic doubt, but it’s bugging my head. I have the following code snippet: A class that receives a list as a parameter in the constructor: public class MinhaClasse { IList<int> Items;…
-
0
votes1
answer917
viewsObject-Oriented Programming
I’ve been developing projects in Delhi since the Easter season, but my big problem is that I never kept myself very updated on the changes and I always used a procedural language and now I need to…
-
0
votes1
answer468
viewsUsing an object in different methods in Objective C
I’m trying to work with objects in iOS Objective C, and I had a question about using. I created a file called carro.h #import <Foundation/Foundation.h> @interface carro : NSObject { NSString…
-
0
votes2
answers443
viewsDoubt about android using classes
I have the following method implemented and I will use it in various Activities private int dia, mes, ano; String data; String dd, mm; int hora, minuto; static final int TIME_DIALOG_ID = 0; String…
-
0
votes1
answer95
viewsNull values in check boxes
In my application, I need that if the User unchecks all check boxes informed to him , be saved a Array nulo or []. I’m using params[:parametro1][:parametro2_ids] ||= [] after initializing my Action…
-
0
votes1
answer200
viewsSwap attributes from one Object to another
In my java application I have a declosed object like Extrair extrair = new Extrair(); And I use this object and its attributes for my Serrvlet. But I need to pass this object to .jsp. In jsp I use…
-
0
votes1
answer940
viewsRepresent coordinates in Matlab vector
I am having problems creating an object vector in Matlab, the idea is that it is a coordinate vector, i.e. the x and y positions. The goal is to have a vector to access the coordinates in the loops…
-
0
votes1
answer221
viewsProblems accessing class attributes when creating java-based System action
Well I have a class that extends a JPanel, in that JPanel i add a JButton and use the method addActionListener to set a ActionListener for this one JButton, but when I’m creating the ActionListener…
-
0
votes1
answer369
viewsInterface vs Class - method visibility
I did a job for school and it’s working perfectly. In the code I have some private methods. I need to create an Interface of this class to hide these private methods or they can be in the same class…
-
0
votes1
answer138
viewsOrientation to Objects in Java
I’m new to Java and I’d like to understand how it works. Like, how I use classe inside the other (and what’s it called)? protected void onCreate(Bundle savedInstanceState) {…
-
0
votes1
answer349
views -
0
votes3
answers1060
viewsImplementation of generic CRUD
I have the following class CRUD that is generic: public abstract class CRUD { protected string tabela = null; protected object classe = null; public CRUD() {} public virtual void insert() { //código…
-
0
votes1
answer403
viewsWhen to instantiate and when not to instantiate the object?
Watching a video lesson PHP I learned that you can use a class in two ways, without instantiating the object and instantiating the object. // Forma 1 echo SEO_URL::Strip('Caçador mata leão na…
-
0
votes1
answer256
viewsIs Generic stabbing possible?
Good afternoon I’m studying by object orientation, and in the middle of the studies appeared various patterns and with them a lot of confusion My doubt is it’s possible to have a generic FACADE. or…
-
0
votes1
answer110
viewsUpdate database by SQL PHP
Staff I am having difficulty updating my database to decrease the weight by 1 kg. Any help I appreciate. The code is as follows: <?php class Aluno{ public $nome; public $endereco; public $peso;…
-
0
votes1
answer259
viewsHow to create an instance of a Prestashop module within a controller?
I would like to create an instance inside the control of a particular module to be able to validate it in the Prestashop authenticator pattern: I am using Prestashop for the version: 1.6.1.3 Path to…
-
0
votes2
answers120
views(Business rule) -Repeated registration
How do I make this business rule that prevents the user from registering an account with the same number and agency ? Main class public class Main { public static void main(String[] args) { menu();…
-
0
votes1
answer1470
viewsHow is a specialization implemented in a bank?
In my ER model and diagram I created a specialization for an entity called clients, where it relates to the physical and legal entities derived from this specialization. I simply create the…
-
0
votes1
answer38
viewserror: 'List ' is Abstract cannot be defined
I intend to use java with Android Studio to make a calculator, however, every time I click an add button to a list the values of these buttons. But having error in the list statement. someone can…
-
0
votes0
answers270
views(Business rule) - Update balance
I am developing a business rule in which the user when typing the number and agency from the bank account, he has two options: 1-Credit: The user will type char 'c' through Jtextfield credit…
-
0
votes1
answer77
viewsHow to override a class from an external project to call a function
I have a solution where contains 2 projects. One of them is the project I pulled from github, so I don’t want to modify it because every time I upgrade I will lose my settings. In this project there…
-
0
votes1
answer1676
viewsOOP PHP - Simple CRUD and Creative Block System
I am studying Object Orientation applied to PHP and I am getting lost in the basics; it does not enter my mind how to organize scripts and classes. I studied Java OO and I have no major problems,…
-
0
votes3
answers275
viewscan’t access already instantiated class data
Hello, I am developing a panel and I am developing the instation system and in the part of creating DB, I am not able to access variable of the instacidada class. Error that appears on the screen:…
-
0
votes1
answer75
viewsProcedural code rewriting error for OOP
The archive wishlist.php available in GIST should, through file methods db.php, perform actions of CRUD and print on the screen the obtained results, but nothing is printed. Likewise the file…
-
0
votes1
answer82
viewsHow can I interact with a class that is behind two?
Good night! I will explain the problem since the title is not suggestive of it. I have to develop an online shopping system, able to manage the purchases of each user. If you think about it,…
-
0
votes1
answer134
viewsHow to set a jcombobox in a Preparedstatement?
How do I make a jcombobox in this method? The Combobox would be the type the user is supposed to choose, I tried to make one but it didn’t work out very well. And this method is in my main class and…
-
0
votes0
answers27
viewsWhat is the difference between Casse obj; and Class* obj = new Class(); in C++?
I know that using Class obj; I’m storing obj in Stack and with Class* obj = new Class(); I’m storing in Heap. But in practice, what’s the difference?
-
0
votes3
answers2201
viewsHow one class can inherit from one interface and another class in Delphi
I’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
votes1
answer97
viewsHow do I make a variable become an object?
Model: public function gettoken() { $token = $this->db->get('token'); return $token->result(); Controller $this->load->model('Mod_login'); $get = $this->Mode_login->gettoken();…
-
0
votes0
answers213
viewsPHP using MVC
I’m creating an application in PHP (without frameworks) using MVC, but I’m having a lot of doubts, because until today I only used Symfony to make PHP applications. I have doubts about the routing…
-
0
votes2
answers1460
viewsStarting an Array of a private attribute in another class
I’m doing some exercises and I came across a problem, follow part of my code: class Empresa{ public String nome; public String cnpj; private Funcionario[] empregados; public String rua; public…
-
0
votes1
answer61
views -
0
votes2
answers488
viewsWhen should I create a class?
I know it sounds like a really silly question, but I’m starting now in the world of programming (focused on mobile). When I create an app it gets all the functions within the Activities, then I…
-
0
votes2
answers306
viewsWhy do builders have to have the same class name?
Is it really necessary for the constructor to have the same name as the class?
-
0
votes1
answer425
viewsWhy isn’t the object being instantiated?
I have a Bean class (Casa.java) public class Casa{ //atribubutos private String parede; public Casa(){ } //getters e setters public void setParede(String parede){ this.parede = parede; } public…
-
0
votes1
answer53
viewsWhy should I create a static method and not one that could instantiate the class and use this method?
I really don’t see any difference in these two methods uses. Could someone be more specific with me and inform me about this?
-
0
votes1
answer39
viewsabstract methods of the same signature
Hello, I am building for my college work a Webservice based on MVC architecture. For a better understanding of the problem I will explain a little how the classes are currently: The abstract Model…