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
votes2
answers146
viewsNo return function
I am following an OO study book and I came across a problem related to a method call. I will contextualize with the Classes. <?php class Orcamento{ private $itens; public function…
-
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
votes1
answer132
viewsTkinter Entry always captures empty string
I am trying to create an application with graphical interface using the Tkinter. The graphical interface consists of a button, one text and of a entry, as in the image below. The idea is to type a…
-
0
votes0
answers55
viewsI created an Eternal Object, but I can’t explain why it works
Hello, everybody. I am solving a list of Python exercises (3.7) and in the first exercise I was asked, in item A), to create a generating function that scans a string for the desired substring and,…
-
0
votes1
answer250
viewsOverflow error
Good afternoon, I’m having a problem with overflow in my Location class, I have no idea why it’s happening. I am beginner in the area, I still have not much notion of these mistakes, someone could…
-
0
votes5
answers153
viewsCall the Java method
I’m doing some POO exercises and I can’t call the method ligar of my code. public class Telefone { public String modelo; public int numeros; public boolean antena; void status(){…
-
0
votes1
answer110
viewsPass parameters on GET
I’m trying to do a GET to validate a user using Cpf and password,using DAO, but I’m not sure when to pass the parameter. Follow the get code private Usuario usuarioLogado; @GET…
-
0
votes1
answer869
viewsHow to get back to the start menu of my program
Guys, here’s the thing... I am doing a project for the POO chair and wanted every time I chose some option and completed the form that is within the classes, I returned to the main menu, until I…
-
0
votes1
answer100
viewsPOO in PHP classes ( reuse methods and attributes from other inherited classes)
I have 3 classes that have the same function, however, some functions have the content of the implementation different from the others: Ex: class CategoryServices { /** * @var CategoryRepository */…
-
0
votes1
answer50
viewsHow do I add the "same" object to a list and change a property?
I have to send a list of entitys to a method that will make the Insert of these entitys in the bank. This entity represents an inscription of a patient who will enter some waiting queues of…
-
0
votes1
answer28
viewsUnexpected return of the method
I am learning POO in python, I have created a client class that has three attributes; name, Cpf and age. And I also created a method that stores these attributes inside a tuple and returns this…
-
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
votes1
answer38
viewsVariable is not found in an operator method
I’m studying operator overload but my code is not compiling. #include <iostream> using namespace std; class Complexo { public: int real, image; Complexo(); Complexo(int r, int i); Complexo…
-
0
votes2
answers55
viewsMethod returning Nullpointerexception (JAVA)
I’m doing an object-oriented exercise, I have a Car object and a Driver object, when I try to assign String name to one of the objects this returning me a Null public class Motorista { String nome;…
-
0
votes0
answers99
viewsHow to make explicit variable type declaration in PHP?
Taking a course on the Internet, I saw the instructor saying that from PHP 4 (he used 3, so did not test) it was possible to make the explicit declaration of type in object attributes as follows:…
-
0
votes1
answer22
viewsHow to create a new instance instead of pointing to the same instance when defining variable?
When defining a variable of type Carbon i cannot copy the object (create new instance with the same properties), just point to the same instance, forcing me to create new objects manually. Example:…
-
0
votes1
answer44
viewsUnintentionally changing the value of the object
Project link: https://github.com/ThomasCaio/RPG2 self.enemy.Damage returns : {'Physical': 45, 'fire': 25} self.Defense returns : {'Physical': 50} def receive_damage(self): damage = self.enemy.damage…
-
0
votes1
answer129
viewsFunction validate users registration
I’m starting in OO in php, and with the function below I’m trying to check if the name coming from the form is equal to some value coming from my user table before making Insert in the table. I wish…
-
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
votes1
answer249
viewsValidation in the constructor - Python
I made this class however, when I enter values that in theory should not be allowed it continues running normally, even having created a function that makes the validation. I can’t get it inside the…
-
0
votes1
answer71
viewsOrientation to Python Objects
How to make the only way to insert the days, months and years are solely and exclusively done by the setDia() method, that is, when instantiating do not want to pass values to these attributes at…
-
0
votes1
answer176
viewsRecover instantiated object in another file in PHP
Quick question: how to recover the instance of an object created in a different file in a PHP application? Full question: I am creating a project for PHP studies where I have the file conn.php which…
-
0
votes2
answers246
viewsCalling a method within a Javascript method
Follows the class: class Advogado{ constructor(nomeAdv, tipoEnderecoAdv, ruaAdv, numAvd, cidadeAdv, estadoAdv, oabADV, estadoOabAdv, emailAdv){ this.nomeAdv = nomeAdv; this.tipoEndereco =…
-
0
votes0
answers125
viewsHow to print the contents of an Object in a List<>
I am developing a JAVA application in which will display the contents of an object in a list. My goal is to print the object content of a list. package teste1; import java.util.ArrayList; import…
-
0
votes1
answer394
viewsError using . stream(). filter in JAVA
I am developing an application in which it aims to create a list that respects the condition of being of type = "unit". In the code below, I create the list and from a function I try to generate…
-
0
votes0
answers16
viewswhen the height is displayed on the screen it stands this way 165.0 and I wanted it displayed this way 1.65
package rpessoa; import java.util.Scanner; public class Pessoa { private string name; int private dia; int private mes; int year; private double height; private int age; // Construtor /*public…
-
0
votes2
answers419
viewsPython project and Tkinter menu
Well my little project with python and the Tkinter library , I’m trying to make a registration system but I’m a little new in this part of object orientation in python, and I think this is the part…
-
0
votes2
answers235
viewsHow to Update to a DB Sqlite3 with POO?
I have a product registration program with everything working only I lack the update, I can update edit the data in the table and in the bank but it is not working right. It edits all the data and…
-
0
votes2
answers74
viewsCreate methods in classes to manipulate fields
I made a code of a binary association between two classes Cliente and Caixa, some methods I might not understand how they are inserted into the code in logical way, but the code itself is working, I…
-
0
votes3
answers418
viewsC# - No argument provided that corresponds to the required formal parameter in abstract class code
There’s a error of arguments provided in 3 constructors of my abstract class code, where the method get() must be written in the child classes of the employee class which are the classes…
-
0
votes1
answer86
viewsHow to return a query column within a class
I’m updating my entire project to object-oriented PDO, but I’m having some difficulty returning a fetch column in the class query User. After several attempts, so was my code: user php. Class User {…
-
0
votes3
answers112
viewsWHERE condition does not work
I’m trying to put a condition in a function and it’s not working... I tried to put this condition but it didn’t work $this->db->where('idUser =', $this->session->userdata('id')); Usually…
-
0
votes1
answer118
viewsObject Orientation (SUPER HELP)
Here is a question that will require a more complete answer, will it happen? Note this script that simulates a person’s behavior. Class is Person and methods are the possible behaviors. Someone can…
-
0
votes1
answer448
viewsObject oriented: "Undefined Reference to" in main.cpp
I’m starting POO (Object Oriented Programming) and am separating my attributes and methods from the class into different files. They are reading each but in main.cpp is giving the error "Undefined…
-
0
votes1
answer24
viewsHow to split the instance of a class through outrw
To be more precise, yesterday I opened a question asking for help in creating a class that acted as a creator of dictionaries, and promptly I was answered, follows the class: ` class tuplas: def…
-
0
votes2
answers281
viewsQuestion about recovering data from database
Good morning. I am a beginner in programming and had an opportunity in a project at work to become a developer. The project is only a panel showing some database data from our main application. I am…
-
0
votes1
answer74
viewsFormat an object print
Time, I need to format the print of the following class: class Tupla: def __init__(self, keys, palavras): self.keys = list(keys) self.palavras = list(palavras) self.op = dict(zip(self.keys,…
-
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
answer62
viewsParameters for business rules registered in the database
Good night, Recently I came across a situation that left me very in doubt, is a module of a system that calculates the value to be paid for a service and for this all rules are expressed in a table…
-
0
votes0
answers30
viewsObject attribute can be filled with function call? Javascript
I’m trying to turn a file. js in module so I can access it in another .js. So this file I want to export needs to be it integer an object, right? Example: File "database" module.exports = {…
-
0
votes1
answer362
viewsProblems with c++ function template (Reference not defined for class methods)
Hello! I’m trying to compile the following code: main: #include "lista.h" using namespace std; int main(){ no<int> *n; n = new no<int>(4); n->setProx(new no<int>(5)); cout…
-
0
votes1
answer167
viewsOverwrite an Inheritance property or not ? Kotlin
I have a question about code : class SaldoInsuficienteException(mensagem:String = "O saldo é Insuficiente") : Exception(mensagem) Now I tested imagining how the code was written in English and the…
-
0
votes1
answer63
viewsJust open the clicked modal?
I have a map of a array object. <S.Section> {data.slice(oldItems, showItems).map((it, index) => { return ( <> <S.Box key={index} onClick={openDetails}> <S.Image…
-
0
votes1
answer54
viewsStarting in POO (PHP) and I have the following question;
I’ve been searching for information for a long time to unravel the mysteries of POO (PHP) and I can’t find them. I would like to know how to call a certain function in another file by running a…
-
0
votes1
answer348
viewsHow to do for instantiating a new JAVA object
I’m in my first object-oriented programming classes and I’m having difficulty with an evaluation. Create a class with at least 10 attributes for creating objects of the Computer type. The class must…
-
0
votes1
answer304
viewsAdd a new object in a list in another class
I populated a list of dishes from a restaurant, after that, I added a function for the user to create a new dish when they want. However, in the method to create the new dish, I cannot add to the…
-
0
votes2
answers174
viewsHow to create class correctly with pandas by applying methods?
I have a 'data.csv' file, with the data below: turma,nome,code,motivo,atividade,trofeus,data 9º Ano Fundamental A,Maria Joana,9X4YK,Realizar atividade Astromaker,Lição A,3,21/02/2020 11:44:11 9º Ano…
-
0
votes0
answers117
viewsAccess another python file method
I have a very simple code that clicks on an image on the screen: from src.imagesearch.functions import clickwithwait class Home: def clickNEWS(self): NEWS = r"..\NEWS.png" clickwithwait(NEWS) This…
-
0
votes1
answer27
viewsHow to establish a communication, in the same file, between multiple PHP tags
Good night. The point is, I’m doing a bank account program, where first, in a.html file, I retrieve some data via form, and send it to another file.php In this same, besides recovering the data…
-
0
votes1
answer150
viewsHow to make the Java Scanner read more than once in a program using classes?
I have to make a code using Object Oriented Programming, where you have a password already predefined and using Scanner you enter at least three attempts (one at a time). The program is reading only…