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
votes1
answer166
viewsProblem with return of PHP’s Mysqli class fetch_all method
So, I’m doing the maintenance of a very large system. I have the query: $query = $mysqli->query("SELECT*FROM tabela"); And the problem is they used fetch_all() to return the data. When the query…
-
1
votes1
answer41
viewsEncapsulating instance structure
Given the following code, implement a small library that makes it possible. #include <stdio.h> #include "object.h" int main() { obj_instance *oi1; obj_instance *oi2; object_init(); oi1 =…
-
1
votes1
answer84
viewsAre inheritance derived classes different tables in Mysql?
If I use inheritance and have 4 derived classes and my parent class is abstract, these 4 derived classes will each have a different table in the Mysql database?
-
1
votes0
answers514
viewsObject Orientation in PHP, crud example with ajax
I’m trying to learn Object-Oriented PHP, but I’m having a hard time finding an example. Someone can show a simple example of the crud case below: A php class, for example user, in this class has…
-
1
votes2
answers959
viewsInstantiate an object through the interface and access methods not present in it
I have the following interface: interface something { void doSomething(); } And I have a class that implements this interface and adds another method that does not contain in the interface: public…
-
1
votes1
answer2555
viewsDifficulties creating update with Laravel 5.1?
I’m trying to create a update with Laravel 5.1 but is bringing the following error: Type error: Argument 1 passed to Illuminate\Database\Eloquent\Builder::update() must be of the type array, object…
-
1
votes2
answers106
viewsReturning an object. Any Smell code here?
I thought of the following public method: public RespostaDeArme armar(); The class RespostaDeArme would be so: public class RespostaDeArme { private final ResultadoDeArme resultado; private final…
-
1
votes0
answers41
viewsDouble-chained list with a graphical interface to browse the list
I’m new to programming, I’m having a hard time. I implemented a doubly chained list I need to navigate the sorted data of the list by a graphical interface, both next and previous, only I do not…
-
1
votes1
answer112
viewsHow is the signature check of the super function
The function super() serves to call the parent builder and verify suitable signatures. public class Pessoa { private String nome; private String endereco; private String telefone; private String…
-
1
votes2
answers154
viewsExplanation in constructor method
I have some questions about the method of constructing a class that I am seeing as an example, if anyone can explain thank you. private static IList<Categoria> categorias = new…
-
1
votes1
answer81
viewsHow do I get multiple columns of a table to reference a foreign key from another table?
How do I get multiple columns of a table to reference a foreign key from another table? I want all columns called "SLOT", CAN store a key from the mods table. NOTE: I’m using the latest version of…
-
1
votes1
answer184
viewsWould it be right to use a static class to consume a web service?
A question that occasionally arises when I am programming is related to the use of static classes. To official documentation Microsoft says the following regarding static classes: A Static class can…
-
1
votes1
answer262
viewsAccess modifier for Java methods - Default
I just took a test and I found a suspicious question, I’d like your opinion. In the Java programming language, when the method of a class does not have an explicitly declared access modifier means…
-
1
votes2
answers907
views -
1
votes0
answers84
viewsObject-oriented unit test
I’m trying to perform an object-oriented unit test, and the same is saying that the object was not instantiated. Follows the code: [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML",…
-
1
votes1
answer111
viewsHow to reconcile good Object Orientation practices and ORM frameworks for getters and setters?
In many of the systems I have worked on or had contact with, the class representing a model is usually a POJO, which we map your attributes for columns (for relational banks) or attributes (for some…
-
1
votes2
answers113
viewsImprove a Bank Search
I would like an improvement help in a Search Query today every Search the user makes in the search field I give an OR in my Where I wonder if you have any better way to do this because I will need…
-
1
votes1
answer337
viewsWhat is the most appropriate way to instantiate a database in an MVC standard
I’m studying POO and a little bit about the MVC structure, and I’m wondering where to create and instantiate the database to be used in the entire application, thought as the Model relates to data…
-
1
votes1
answer700
viewsAssociation between classes with PHP
I searched for content on class relationships, more specifically association, but all the examples I found were not properly encapsulated (attributes and methods declared public), I tried to make an…
-
1
votes1
answer131
viewsHow to implement the Parcelable class?
I need help when it comes to object orientation. I need to implement the class Parcelable in the model Produto, but for the sake of organization, I would not like to implement directly in the class…
-
1
votes1
answer339
viewsCreate pull function()
I have a problem in my logic here, I need to create a sac() function, but it has the following requirements: • Account needs to exist • She needs to have balance greater than 0 • The sake cannot be…
-
1
votes1
answer383
viewsWhat are the advantages and disadvantages of using object-oriented mysqli?
I’ve always used the mysqli the way I found most practical and never noticed any differences. Then came the question: why use the mysqli object-oriented? What are its advantages and disadvantages?…
-
1
votes0
answers756
viewsDifficulty to list data in a Spring Boot table
I am working with a simple Spring Boot project using Thymeleaf, it is a product registration, as I have several types of products to register I found it interesting to create an entity called…
-
1
votes0
answers49
viewsQuestions about continuation in C# studies and suggestions to get an internship
Hello, I’m in 2° SI course period, but I’ve been studying C# on my own through the Caleum: C# and Object Orientation booklet. I’m really enjoying the language and I intend to go deeper into the…
-
1
votes1
answer294
viewsImplementing the concept of inheritance in a database
Why the attribute PessoaJuridicaId is not generated? This is the base class Pessoa: public class Pessoa { public Pessoa() { DataCadastro = DateTime.Now; } public int PessoaId { get; set; } public…
-
1
votes1
answer5104
viewsFatal error: Uncaught Error: Call to a Member Function query() on null in
My class code Users <?php class Usuarios { function listar() { require_once 'controller/conexao.php'; $sql = "SELECT * FROM usuarios"; $usuarios = $mysqli->query($sql); while ($linhas =…
-
1
votes2
answers322
viewsDoubt about how to iterate on an Arraylist
I have this exercise below to do put in question "D" I’m struggling , if someone can explain me how I should do : a) Create an interface called ModeloContato with the methods getNome(),…
-
1
votes0
answers60
viewsCall a class extension within the mother class?
I work with a kind of framework for HTML rendering and events, among other essential things, which is actually a standard HTML code generator because I can use either as a direct renderer or as an…
-
1
votes2
answers650
viewsObject orientation with jQuery/Javascript
I’ve read several things about it,: var classe = function () { var metodo = function () { return 0; } return { init: function () { metodo(); } }; }(); jQuery(document).ready(function () {…
-
1
votes1
answer297
viewsConcepts for the adoption of object orientation
I came across this question, researched it and the correct answer is: e) computing is triggered by the exchange of messages between objects. I agree that the And is true, but what I don’t understand…
-
1
votes0
answers212
viewsInheritance attributes using abstract class
I’m looking to use inheritance with parent class being abstract. The point is that I’m using the toString() superscript so that each print of child classes can print their respective data. But when…
-
1
votes0
answers491
viewsQuestions about Abstract Classes and Interface (java)
Before I express my doubt it is valid to make clear that in a certain way I understand the difference between the two. I know that a abstract class can have implemented methods, attributes,…
-
1
votes0
answers708
viewsI need to know how to kill/delete an object
I’m with a program, in which there are some objects, which in this case are "blobs" or round beings, which through ids(identification numbers) can kill each other, but I can’t make the death…
-
1
votes2
answers80
views -
1
votes1
answer53
viewsHow do I make the methods receive the x and y parameters?
When I ask for the values of x and y, i want to make the operations of the methods receive the values entered by the user. What to do? public class Calculadora { Scanner sc = new Scanner(System.in);…
-
1
votes1
answer54
viewsHow to allow only the creation of valid objects in Python?
class Linha(object): def __init__(self, x, y): self.x = x self.y = y @property def x(self): return self._x @x.setter def x(self, valor): if valor >= 0: self._x = valor @property def y(self):…
-
1
votes1
answer58
viewsError creating Python object
class Linha(object): def __init__(self, x, y): self.x = x self.y = y @property def x(self): return self._x @x.setter def x(self, valor): valor = int(valor) if valor >= 0: self._x = valor else:…
-
1
votes1
answer1729
viewsHow do I inherit an abstract class in C++?
In Java we have the possibility to create abstract classes, but without the possibility of instantiating them, but we can create and instantiate a class that inherits the attributes and methods of…
-
1
votes1
answer785
viewsRemove duplicate elements from a python chained list
My code returns error when trying to run: class No: def __init__(self,inidado): self.dado = inidado self.proximo = None def pegaDado(self): return self.dado def pegaProximo(self): return…
-
1
votes1
answer288
viewsI have a question about inherited default builders
I am doubtful when trying to improve a POO exercise here.. (-) = without I have the PAI class with two constructors (one is default). In the FILHO class I have two more constructors (no-default). In…
-
1
votes1
answer143
viewsI cannot return assigned values to variables
I am layman programming myself and decided to start a program in python to use as a tool in a game well, the code so far is this: def tempo (temp): total=temp*quant dias=total//(24*60*60)…
-
1
votes0
answers126
viewsExecute a class function based on a property
Please, I need to execute a function of a class among several classes that I only know is correct from the value of one of its properties. I create the classes for example: public tabelaSerie = new…
-
1
votes2
answers441
viewsWhen I use the __Construct method do I not need to use get; set?
I have the method __construct in the class, I must create the set and get methods? <?php class Produto{ //atributos private $descricao; private $preco; //método construtor public function…
-
1
votes1
answer1225
viewsPolymorphism with interface and abstract class
How do I make a method defined on the interface iDAO is passed on to be implemented by the class ProprietarioDAO, daughter of the abstract class absDAO, implementing iDAO? import { EntidadeDominio }…
-
1
votes1
answer74
views -
1
votes2
answers362
viewsPOO JAVA - Doubt Exercise
Good first follows down the exercise: Create a class called Date including three parts of information as instance variables: one mês (tipo int), one dia (tipo int) and a ano (tipo int). Provide a…
-
1
votes1
answer447
viewsDoubt about the price calculation
My doubt may seem simple to someone, but to me it’s kind of killing me because I’m trying to find the mistake and I’m not getting it. At first, I know very little about object-oriented programming…
-
1
votes4
answers938
viewsPrivate or protected class in PHP
You can create a private or protected class in PHP to allow access to its variables and functions only to other specific classes? Applying: I have a class where I create a connection with the…
-
1
votes1
answer57
viewsHow to take the return of this method
I’m using the lib betterpickers, I tried to make a class to take your information form OO, however the method does not have a return, it is a void, there is a way to catch this return? public class…
-
1
votes3
answers110
viewsHow to call the same method with different arguments but inherited from the same mother class?
I have two classes (ColunaDoGrafico and ColunaDoRelatorio) extending from Coluna. My Column class has the following structure: public class Coluna { protected String tipoFiltro; protected boolean…