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
answer77
viewsGame modeling
The game will be fighting between pairs of characters. Classes that are required to implement the following: Personagem (abstract class) -> Orc / Humanos (interfaces) -> Arqueiro (Human) /…
-
0
votes1
answer51
viewsDjango. I can’t pass the model I’d like through classes
I’m having a problem creating a page to create new products and know I’m having some problem with Oop for lack of experience. I would like to pass the value of self in this case being self==Product,…
-
0
votes1
answer141
viewsPackaging in Kotlin
I am starting my studies in Kotlin and am trying to solve the following problem: Create a class to represent a person, with private attributes of name, date of birth and height. Create the necessary…
-
0
votes1
answer83
viewsWould this class relationship be correct?
I am currently studying about classes, more specifically class/UML relationship and I am doing it in C#. I would like to know if this code I wrote below is the most suitable or if there is a…
-
0
votes1
answer23
viewsIdentical objects with same value fields returning different C#
Identical objects with equal fields returning different when comparing with Equals or == var oldPayments = orderNotTrack.Payments .Where(p => p.Status == Status.Activated) .Select(p => new…
-
0
votes0
answers32
viewsGetters, Setters and Constructors (JAVA)
Good afternoon guys! Okay? I hope so! Well, I started my studies about 3 months ago in java and programming in general. Well, I am in a stage selection process and I started to study POO (Object…
-
0
votes1
answer49
viewsDoubt about polymorphism
Hello, good afternoon, I have a question related to polymorphism. Suppose I have an object Casa implementing Imovel where Imovel has a method getValorIptu() and House has an attribute…
-
0
votes1
answer60
viewsDefine Entity Account in dotnet
Hello, I have to define an Entity Account for a microservice of retail software. An Account can be the type: Individual Familia Enterprise Being the type individual is composed of the traditional…
-
0
votes1
answer24
viewsIn a small application would it be a valid option to use 'Quick.db' or would this cause future problems?
I am programming an API for use in a small Windows application and I had some questions when it came to implementing the API. When choosing the database to use in my application, I found a problem…
-
0
votes1
answer50
viewsWho is the instance, who is the instance? Java
Hello, I’m new with object-oriented programming and programming in general too, but in an example like the following: public class Profissao{ public void trabalhar(){ //trabalho... } } public class…
-
0
votes0
answers24
viewsTable relationship command not working
Good afternoon, I have a function with a query to search a list of photos of a certain product in the Product class: class Produto { private $mysql; public function __construct(mysqli $mysql){…
-
-1
votes2
answers271
viewsUsing data in the database
I am creating a quiz. I managed to create the screen to create the questions, this recording in the database everything right. Only now I will do the "game" itself, so I would have to take a…
-
-1
votes2
answers953
viewsIt is wrong to use common variables within a PHP class
Is it a wrong form of POO? Can I only use attributes within my class? Can I use type variables $Variavel, when necessary? I mean, don’t use the public $variavel, or var $variavel, private $variavel.…
-
-1
votes1
answer89
viewsProtected methods of a DLL
I have a DLL that has several internal methods, I want to protect these internal methods so that they are called only by the DLL itself. Is there any way to define which methods may or may not be…
-
-1
votes2
answers38
viewsHow to make constant member functions in Php?
I was studying what my book called "constant member functions" in C++. i.e., functions that cannot change any class attribute or call other methods that are not constant. So, I made this code in…
-
-1
votes1
answer55
viewsAdd values in a 3-dimensional matrix
How do I get the user to add values to an array [][][]? calendarioEventos = new Evento[dia][mes][hora]; for(int i = 0; i < calendarioEventos.length; i++) { for(int j = 0; j <…
-
-1
votes1
answer279
viewsSimulate the operation of a processor using java swing
I need to simulate the workings of a processor using queue concepts. This processor will be color, where the user adds the color they want to be processed and its run time, this color needs to enter…
-
-1
votes1
answer50
viewsI made a capture of fields of the comic and gives this error
After I put this code below .... $capturaValorTotal = $_POST['valor']; $capturaValorPagar = $_POST['valor-pagar']; $valorDevido = $capturaValorTotal - $capturaValorPagar; $inserindoBanco = "INSERT…
-
-1
votes1
answer180
viewsWhat is the difference between the ending, Finally and finish in Java?
What is the difference between the terms: final, finally and finalize(), in the programming language Java?
-
-1
votes1
answer115
viewsHow to create a parameterized Java method?
This is a Java method that is very coupled, and I need to decouple this method because there is a lot of code inside it, the block of code that I need to get inside the method uploadfile() is marked…
-
-1
votes1
answer40
viewsFunction that returns a new instance of a class
Can anyone explain to me why this function is not returning a new instance. It returns a monster object exactly as I want, but when the monster dies, the new instance it returns comes back exactly…
-
-1
votes1
answer279
viewsjava:7: error: invalid method declaration; Return type required
Name of the complete error: Cliente.java:7: error: invalid method declaration; return type required public cliente() { ^ Code I used: import java.net.Socket; public class Cliente extends…
-
-1
votes1
answer81
viewsRead objects through the Scanner class
[![PHOTO OF THE CODE][1]][1] I am not able to instantiate an object and read it with the method of the Scanner class. It is possible to do something like? Scanner s = new Scanner (System.in); Notas…
-
-1
votes1
answer65
viewsMemory leak in Return
I’m reading a book and I came across this code: class SimpleCat { public: SimpleCat (int age, int weight); ~SimpleCat() {} int GetAge() { return itsAge; } int GetWeight() { return itsWeight; }…
-
-1
votes1
answer110
views -
-1
votes1
answer326
viewsHelp with PDO (PREPARE)
Hello. I am trying to make a CRUD using PHP OO. But when I run, I have an error in the preparation of the PDO class. I have only the bank registration code and the bank connection code for now:…
-
-1
votes1
answer35
viewsWhat is the use of nested classes in python? for which I would use something like that?
I can’t find much python-like, I know you can do that and I know how to do it, but I don’t know why anyone would want to do that, since the inner class is unable to access the attributes and methods…
-
-1
votes1
answer36
viewsInvoking methods within an Arraylist does not recognize the object method
I try to invoke the method through the method get().getNome(), but says that the method does not exist.…
-
-1
votes1
answer39
viewsWhat does the context class do for the Strategy design standard?
If Strategy uses its abstract class as a means of instantiating concrete implementations, what is the function of the context? In certain materials it was cited that this patter design would be…
-
-1
votes2
answers50
viewsDoes every attribute need advisory methods?
I am learning POO in Python and I was in doubt whether I should use advisory methods for all the attributes I include in a class. For example, if I create a class with 20 attributes, in which values…
-
-1
votes0
answers22
views(Python) Using a Private attribute in a subclass
My wish is to validate my IF in class B using a private attribute that was done in class A. Nothing more than that, I am aware of some methods to verify an anonymous attribute but still I could not,…
-
-1
votes1
answer405
views -
-1
votes1
answer89
viewsDo While is not working properly
Do while is not working in the code. At first the test that I am doing now is only the first of the menu (register the user) and then should go back to the menu until S is typed. (It is running only…
-
-1
votes1
answer36
viewsDoubt in the storage of variables
I’m a beginner in C#, and I’m trying to save the values typed in a toolbox within the property of a Classe, but the code does not compile. Could someone help me? Form: namespace ProgramPrestServico…
-
-1
votes1
answer27
viewsAccessing method (beginner)
I started my studies recently and a question arose regarding the access of information of a method. I have an X.php file that has the following structure: public function…
-
-1
votes1
answer373
viewsInstantiating a class in another constructor in PHP?
I have a class called teacher who is heir to another so-called person, I am trying to instantiate a third class of connection with bank in the method constructing the Teacher class, but it is…
-
-1
votes1
answer45
viewsDoubt in the use of the to_string function
In an exercise that I’m doing, it was proposed to read two numbers, an integer and a real, and count how many digits they have. Entry and exit should be like this: Entre com o numero inteiro: 2345…
-
-1
votes1
answer49
viewsNullpointerexception do not know how to solve
I’m making a house class and a door class, and in the house class I’m declaring 3 doors and when I’m going to run gives Nullpointerexception, could someone give me a light class of my door package…
-
-1
votes1
answer158
viewsCollection of an Object making calculations with Bigdecimal
I have the attribute valorTotal this value must be represented by the sum of all items in the Item class that are in the list items, I am trying to make the sum of all the items in the list that are…
-
-1
votes2
answers175
viewsSetters in an array
I have a array of private integers separated into one class (Obs.: I did so to train the use of the get and of set) and another class that must set values at the addresses of array. This is a…
-
-1
votes1
answer370
viewsDisplay data from an array of objects stored in memory
I cannot make a method that returns the information of registered students. package menu; import java.util.Scanner; import modelo.Aluno; import repositorio.RepositorioAluno; public class AlunoMain {…
-
-1
votes1
answer394
viewsAdd 2 attributes and return to a third attribute
I am trying to add two attributes and return the value to a third attribute, follow example, it is possible and if yes what I am doing wrong? package testesomaatributos; public class…
-
-1
votes2
answers840
viewsObject-oriented programming exercise in Python
I started studying object-oriented programming in Python this week and did an exercise but I don’t know if it’s right. I need someone to take a look at it to point out my mistakes because although…
-
-1
votes2
answers1504
viewsObject array in JAVA
You guys talk beauty ? So, I’m a beginner in java development and my first cruel question that I faced in a question in the course was the following. "Register data from a current account or savings…
-
-1
votes1
answer89
viewsclass call error
Good morning to all!! Guys, I’m going back to dealing with pure php and I came across a mistake half beast, but I’m not knowing how to solve...the error is : C:\xampp\htdocs\PDO\index.php:5 Stack…
-
-1
votes1
answer118
viewsCreate new object without overwriting the old one in javascript
I have a form with several inputs, available at https://jsfiddle.net/elenderg/6hofsyzw/ The goal is that the user can store several aircraft, which have a number of values. How can I store this data…
-
-1
votes1
answer102
viewsCircle area application: method shows that not all code paths return value
I have a code that performs the calculation of the area of the circle on three insatiated objects in AppCírculo, only that the method getArea() that should return the area of the circle with the…
-
-1
votes1
answer1402
viewsManipulating class within another class and saving in array
I created a class Pessoa and in it an attribute endereco, only I made a class Endereco to register more than one endereco per person. In that other class Endereco has id and nome da rua, and I can’t…
-
-1
votes1
answer315
viewsCannot implicitly convert void to string in abstract classes
My abstract class code has two errors: Cannot implicitly convert "void" to "string" (Line 5, 6, 11, 12, 17, 18, 23, 24) using static System.Console; public abstract class DevilHunter { public string…
-
-1
votes1
answer112
viewsA program that every time it is called updates the time and return
Good night I’m trying to make a program that tests if the internet is working and if not returns the time that will be stored in a file so I can complain to the internet operator. Since whenever I…