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
-
0
votes1
answer432
viewsHow to change an attribute in a list of objects and write that list in a file
I have a list of objectsconList I want to change an attribute of an object and then write that list in a file, where each line of the file is an attribute of each object in the list. How do I do it…
-
0
votes0
answers44
viewsCast problem
I have the following classes: public class Hotran { @Getter @Setter private String codEmpresa; @Getter @Setter private String nomeEmpresa; @Getter @Setter private Long voo; @Getter @Setter private…
-
0
votes2
answers602
viewsObject orientation in python
I’m a beginner in Python, I took some courses and I’m trying to learn Tkinter, I found a playlist on youtube with a guy who made a BTC trading app with Tkinter and he created a class to open more…
-
0
votes1
answer3183
viewsRequire_once is unable to access file
I’m not being able to include pages in my file controle_login.php, as it generates the following errors: Notice: Use of Undefined Constant ABSPATH - assumed 'ABSPATH' in C: xampp htdocs Modelo_mvc…
-
0
votes1
answer100
viewsWriting code with python 3
Good guys are... I am currently working on a project, where in one of the functions the script has to write a certain code that was generated from parameters chosen by the user, but after generating…
-
0
votes1
answer34
viewsI can’t run a class
So guys, I’m trying to run an app to upload an image to my server. Without saving this data to the database, the upload usually occurs, but when trying to include the image link in the database, php…
-
0
votes0
answers28
viewsUse more than one -> in the same PHP code line
I made my transition from Java to PHP and recently bumped into something I used to do in Java but am not able to do in php. The following code creates an object of type "User" public function…
-
0
votes0
answers76
viewsImplement interface with linked lists
Good evening, everyone, I could use a hand here. I’m starting to learn the implementation of linked lists in java, but I can’t understand or find a solution to this. I have this interface: public…
-
0
votes1
answer37
viewsWith using conditions within a PHP method
I already ask forgiveness for some kind of mistake in the creation of the question, I am willing to receive help I have a login using classes that after logging in the user, who is saved in the BD,…
-
0
votes1
answer588
viewsSELECT with PDO and PHP OO
I am just starting my study on PHPOO, leaving more of the area of Structured... And after some studies, I obtained a part of the knowledge, but when trying to make a search in the database to verify…
-
0
votes0
answers55
viewsOrdered score from A to Z
I have a query, which I imagine is in object-oriented php, which in my case I’m at the beginning of studies(I know I’m late). I have a platform Xtech, and at the time of display of some features, I…
-
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
votes1
answer914
viewsUse return of one method in another method of the same class
I am working with The Guardian API, through two methods, search_content() and data_to_csv(), contained in the Theguardian class. The first method is responsible for searching The Guardian database…
-
0
votes1
answer413
viewsExtending Parent Class method in C++
I have a sphere class : class CEsfera{ protected: double centro[3]; double raio; public: CEsfera(); CEsfera(double x, double y, double z, double r); mostra() { for (int i=0; i<3; i++) cout…
-
0
votes0
answers99
viewsHow to use a Friend function within a class
My program is structured as follows : Classe.cpp // Implementation of class methods Classe.hpp // Prototypes of the class Main.cpp // Main file In my file Classe.hpp I have the prototype a function…
-
0
votes1
answer61
viewsHow to reuse class values?
I have three classes, the third one depends on the values of the other two (it depends on the E class Material and of A, Ix, Iu and Iz class Geometria. How can I do this? I know I need to correct…
-
0
votes1
answer117
viewsPython Guess Game
I was doing a job, and I ran into some problems. This code has a limitation: Whenever the player selects some number that has been selected before the code does not invalidate and is considered as…
-
0
votes0
answers756
views"A reference to a non-static member must be relative to the specific object" when calling class c++ method itself
I have a class where, within a non-static method, I want to make a call to another non-static one as well. However, by doing so, Visual Studio already gives this warning: "A reference to a…
-
0
votes1
answer114
viewsGeneral game in Java
Good afternoon guys, I’m doing the General’s game (java dice). I am in doubt on how to compare the data between them. Sequel Possible sequences: 1-2-3-4-5 / 2-3-4-5-6 / 3-4-5-6-1 Number of points:…
-
0
votes1
answer140
viewsPython Method resolution order (MRO)
Let’s say I have something like this: # -*- coding: utf-8 -*- class Base(object): @classmethod def foo(cls): pass def grok(self): pass class A(Base): @classmethod def foo(cls): print('A')…
-
0
votes0
answers44
viewsRelationship between performance and scalability
I was facing problems to carry out the maintenance in a code of my own, due to the extensive and little defined classes (grew a lot over time), to simplify the question I will divide the time line…
-
0
votes1
answer63
viewsAm I doing this exercise right?
Until then I am able to do it, but the method imprimiAgenda() is printing, but at the same time giving null Pointer. And also want to know if my logic is going well. If you can help me, I appreciate…
-
0
votes2
answers1874
viewsProblem importing a class from another folder and using it. (Python)
I’m going crazy here. I’m facing a problem that should have been solved by logic already. The problem is this: I have two folders: Novapasta/ Novafolder/classes In the first folder there is a file:…
-
0
votes1
answer72
views -
0
votes1
answer1157
viewsHow to Instantiate a PHP Class
Usually to instantiate and use a class in my project, I use: include ('arquivo_que_contem_a_classe.php'); $obj = new obj(); $obj->nomedafunction(); But today I needed a ready-made class…
-
0
votes1
answer94
viewsMethod that works without I call you directly
I’m messing with the Entity Framework and I was mapping to a Many to Many class. What happens is I used a method I can use inside the DbContext to rename a table, and it works smoothly. But I was…
-
0
votes0
answers203
viewsHow do I use to call another namespace without using include?
I see programmers all the time using the "use" command below the "namespace" command without first using a include. An example is the Medoo library: namespace Medoo; use PDO; use Exception; use…
-
0
votes0
answers28
viewsHelp with object creation
How I put the method descontoINSS on that page? <?php include_once("Pessoa-class.php"); include_once("PessoaFisica-class.php"); include_once("Funcionario-class.php"); include_once("index.php");…
-
0
votes1
answer21
viewsCan I inherit namespaces?
I’m using composer with autoload in class namespaces, assuming I have the parent class Model: Model.php <?php namespace App\Model; use App\Utils; use \PDO; class Model {} And the daughter class…
-
0
votes1
answer40
viewsPDO error - Call to a Member functio on null
I created a function to make a query in the BD and return a User from the variable $nome passed by parameter, however, when testing it enters the Else, someone would know where the error is? Note:…
-
0
votes2
answers82
viewsDoubt about attributes and POO methods in PHP
I am studying POO in PHP and came across an example that I did not understand: The part of the code I don’t understand is because the attribute $produtos this being passed/calling the print() method…
-
0
votes1
answer91
viewsPrivate method in JAVASCRIPT class
How to define a private method in a class JavaScript in order to make the method msg_privada as private (not externally visible) without changing the rating pattern? The method msg_privada must be…
-
0
votes0
answers52
viewsSingleton and Prototype Standard
I am developing a project where I came across the following situation: There are two families of algorithms that use a given object in different ways: the first just read the data and do a…
-
0
votes1
answer942
viewsRelation Between Classes in Python
Imagine that you are developing a system for controlling a Vehicles. With this it is necessary to register the vehicles available at the dealership for sale. a) Think about the necessary data and…
-
0
votes1
answer33
viewsI need to make the igName() method return if they are the same or different. I made the comparison with double and function, but with String the if does not compare
Computer package Exercício06_Aula8; import Objeto.Objeto; public class Computador { private double ck; private double hd; private String nome; public void setCk(double ck) { this.ck=ck; } public…
-
0
votes0
answers52
viewsArraylist JAVA doubts
I have an object "Itemsoliccompra" and within that object has another object called "Product" and product has attributes (name, id, etc...). I have a list that sometimes these products repeat (id,…
-
0
votes1
answer106
viewsProblem for instantiating class
I am creating an MVC application where there is dependency injection to instantiate the classes with connection to the database, the problem is when I climbed the application to a remote server,…
-
0
votes0
answers152
views@Stateless on CDI project
Person, I have the following structure in my project (CDI): BEAN: @Named @SessionScoped public class ClienteMB extends BaseAbstractMB<Cliente, ClienteDTO> implements Serializable { @Inject…
-
0
votes1
answer62
viewsPrint contents of an object belonging to a Treeset (Collection)
I have a Treeset that will store several objects of a class "Products", this class has 3 attributes: int commodity; String descProduct; float precoProduct; After storing some "Product" objects in…
-
0
votes0
answers155
viewsErrorexception (E_ERROR) Trying to get Property of non-object
I tried to turn the page using backup to solve the problem but I can’t. I go up the page and she keeps on making the same mistake, I don’t know how to fix it. If there is some easier way for the…
-
0
votes1
answer172
viewsHow to split the addressing of a class into PHP?
What is the best way to divide this Aluno? <?php class Aluno{ private $nome; private $sobrenome; private $email; private $telefone; private $cep; private $rua; private $endereco; private $numero;…
-
0
votes0
answers229
viewsOpen a modal of another POO React class
I’m learning Javascript and POO so I may be doing something stupid, I’m trying to make a navbar and this navbar open different functions of different classes in other files. That part where you have…
-
0
votes1
answer355
viewsUncaught Argumentcounterror in construction
I’m trying to list the database data, only when I try to list it returns the error: Uncaught Argumentcounterror: Too few Arguments to Function processes::__Construct(), 0 passed in When I declare…
-
0
votes1
answer2108
viewsNotice: A non well Formed Numeric value encountered
I created a fictitious example of a discount on a person’s salary, the code works, but two appear notices I listed below the code: class Descontos{ public $salario; public $inss; public…
-
0
votes1
answer64
viewsHow to delegate UI methods automatically
I created these methods in the interface: public interface IEvents { void OnEscrever(string text); void OnEnable(bool b); void OnDisable(bool b); } I’ll have some classes that will inherit these…
-
0
votes1
answer101
viewsWhat is the relationship between the application layer and the controller class?
The book Using UML and Standards presents briefly the layered architecture, one of which is the application, also called the application controller. It also features the GRASP standard called…
-
0
votes1
answer56
viewsPython error with object orientation
class DBAction(object): __conn = None __cursor = None __id = None def __init__(self, arg): self.__id = arg self.__conn = sqlite3.connect('clientes.db') self.__cursor = conn.cursor() def…
-
0
votes1
answer365
viewsinsert multiple objects into an object array
When I insert the next object it returns a Boolean false public class Main { static Aluno aluno = new Aluno(); static Scanner s = new Scanner(System.in); static RepositorioA repositorioA = new…
-
0
votes2
answers96
viewsMerge Sorted Java
I need to merge in java, with values of an Instance of a class, Queue a and Queue b, I made a method to insert(), in the Queue class. and would like to access the values of a and b. And assign these…
-
0
votes1
answer56
viewsDoubt in activity with POO
Hello, basically the exercise is to have the user type numbers in an array and then I have to have the array separated into another 2 : one for pairs and the other for odd ones. I’ll leave the code…