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
answer508
viewsJAVA POO - How to call a function from a Class
So I have the following problem , I created a 30x60 matrix in which I will generate a number in a random position, so far so good. But when I took the function that generates the number and put it…
-
1
votes1
answer82
viewsClasses with operations extending another class
I have a class called cliente class cliente { private $id; private $nome; function getId() { return $this->id; } function getNome() { return $this->nome; } function setId($id) { $this->id =…
-
1
votes2
answers165
viewsCalling the method of a specific superclass
Suppose I have the following hierarchical structure in Java: First a class Avo: public class Avo { protected String nome; public void falar() { //Codigo aqui } } Next I have a class Pai who inherits…
-
1
votes1
answer138
viewsHow to determine the level of access of the elements of a class?
This is a question of the Secitec 2018 competition for the position of computer teacher. I appealed to this question because there are no qualifiers, but access modifiers such as: private, protected…
-
1
votes1
answer340
viewsHow to get a list of JS objects in Controller C# MVC?
I have an object with a list that will return me 3 or more items. I pass this object like this: var jsonObjs = JSON.stringify(arrayObj); alert(jsonObjs); CarregaNotas(jsonObjs); function…
-
1
votes1
answer942
viewsHow to access parent class attributes in PHP?
How do I access the parent class attributes once I instated the child? Direct access $Filho->atributoPai doesn’t work. Access by function $Filho->getterPai doesn’t work. For every inherited…
-
1
votes1
answer119
viewsHow to use different implementations from the same interface
I’m having trouble understanding the diagram and specifications below. How I do the method double getCalculaFrete() return the same value returned by the method double calcularFretePedido(), being…
-
1
votes2
answers139
viewsCode problem in Java
I am doing a program in basic Java. At the moment there are 6 classes, however, you are having problems in 2 classes at the time of registration. I’m making a SET to register the name of the player…
-
1
votes2
answers183
viewsInstantiated object does not appear in function
Hello, I am creating a Java project using Eclipse with windowbuilder. Inside this project I have Jframe with the objects, jbuttons, jtextfields, jformattedtextfields, etc... I have all these objects…
-
1
votes0
answers51
viewsEntity mapping with . Net Core 2
have the following entities: public class Transacao : IEntity { [Key] public int Id { get; private set; } public int LojaId { get; set; } public virtual Loja Loja { get; set; } public int…
-
1
votes1
answer696
viewsRedirect after login Standard 5.5
Good morning, I’m using Laravel’s standard authentication scafold, and repurposing the structure by overriding the methods I need for you to behave the way I want you to. I customized the default…
-
1
votes1
answer987
viewsGrab each row of a CSV file
I need to take data from a CSV file and store it in an array. Example: CAIO ; 0909;abacaxi BRUNO;1231;maça I have to take for example row 1, and each value of each column store in a variable to play…
-
1
votes2
answers113
viewsDoubt C# ADO.NET class - Accessing data from a Datatable
Hello, good evening, I’m new here and a beginner in C programming#. I am developing a CRUD vinyl record system (a particular hahaha addiction), using ADO.NET classes, similar to the article below.…
-
1
votes1
answer35
viewsProblem with a string attribute of an object
Hello! I’m having a problem with a member of the string type of my object. When I do the object.word assignment = "some word", the program even compiles and runs, but when I print the content, it…
-
1
votes1
answer973
viewsJava - error: cannot find Symbol - Even with created object
I created these two classes: Java equipment. class Equipamento{ private int id; private String nome; private String local; public void setId(int id){ this.id = id; } public void setNome(String n){…
-
1
votes2
answers96
viewsGuidelines for using object or procedural guidance in Python and PHP
I am studying PHP and Python and I am feeling a huge difficulty, not in relation to concepts, after all they are independent of language, what is making hard the study is how PHP implements the…
-
1
votes1
answer219
viewsHow to access methods of an object array?
I am doing a work of the college in which I have to develop a banking system, for this I have 3 types of account (1 class for each type), therefore I want to use an array of generic objects. The…
-
1
votes2
answers104
viewsUse/change property of an extended class and print by instance
Example scenario Root folder Classea.php Classeb.php index php. Filing cabinet: classeA.php class ClasseA { public $retorno = null; public $error = "Erro desconhecido"; function __construct { $this…
-
1
votes3
answers227
viewsWhat is the pattern represented by this class called?
I wonder what kind of class this is DaoDeAutenticacao, whose skeleton I wrote down. Despite the name I don’t think it’s a DAO (Data Access Object), however it is defined, and yes something else (a…
-
1
votes1
answer58
viewsHow to avoid many "use" namespace resolution calls
I’m refactoring a small system in mvc that used the standard classmap to the psr-4, and was "obliged" to use multiple "use" within each controller to resolve the namespaces. Example of what the…
-
1
votes2
answers122
viewsSQL-C# ~ Add Student if not in class
Good morning, I have the following code below: public void AdicionarAlunoTurma(Adicionar_Alunos aluno) { List<string> parametros = new List<string>(); StringBuilder query = new…
-
1
votes2
answers1025
viewsAccess private attributes of a class within another class
I started studying PHPOO and I’m having difficulty accessing the attributes of the class Pessoa that are private within the class Login, follows the code class person class Pessoa { private $nome;…
-
1
votes1
answer75
viewsHow to prevent an object from being instantiated with a certain property?
I want to prevent an object from being instantiated with a certain value (for example, prevent a "battery" object from having a negative value or above 100). How can I prevent the instance from…
-
1
votes1
answer52
viewsError when instantiating object [not defined]
I was doing a simple exercise, but when using the object appears as undefined... class Aluno{ constructor(paramNome, paramNot1, paramNot2) { this.nome = paramNome; this.nota1 = paramNot1; this.nota2…
-
1
votes1
answer78
viewsHow to iterate inside a list that is inside another class?
I wonder if it is possible to iterate a list that is in another class. On a social network, every user has a list of posts, but this list is defined only in the class User how to iterate inside it ?…
-
1
votes1
answer62
viewsProblem instantiating two models in a php controller
I made a mini framework, where the Models extends from a standard class that contains a crud, the only thing the models have is the table information to be used. But when I try to use two models in…
-
1
votes2
answers503
viewsCreate function that calculates Java irreducible fraction
I am developing a challenge in Java, and I need to create a function that calculates an irreducible fraction to solve the problem. I created a function from some search but the function does not…
-
1
votes2
answers55
viewsError searching/searching for attribute in a vector
In this program with you insert the object peacefully in my vector with the method (Adder), but after I cannot fetch the string "plate" that the user typed... program always shows "Vehicle not found…
-
1
votes1
answer404
viewsWhat function and how to use Controllers in Laravel
I’m learning Laravel by a channel, and left me doubt... How should I create my Controllers? As far as I understand it, the view asks for it, the controller will validate and successfully calls the…
-
1
votes2
answers281
viewsClass that implements two interfaces that have identical signature methods
I have a class that implements two interfaces. Each of these interfaces has an identical method, for example: public interface InterfaceA{ void doSomething(String params); } public interface…
-
1
votes2
answers962
viewsValidating null and/or empty fields when creating Java objects
I have an object and would like to force the filling of attributes at the time of the creation of the object. What is the best way to do this? There are the annotations @NotNull, @NotEmpty and…
-
1
votes2
answers143
viewsClone a list in Java
I have a class that reads a csv file and puts the table data on a list. public class Gerenciador { public LinkedList<Acidentes> listAcidentes; public Gerenciador() { listAcidentes = new…
-
1
votes1
answer436
viewsString error using the nextLine() method in Java
I have a problem with a simple java program. When I run and scan with String, it simply goes straight to the end of the program, but when I put char it does not pass and runs normally, even so I…
-
1
votes1
answer246
viewsClasses with private Javascript properties
I’m starting my programming frontend, and started messing with classes in Javascript (following the standards set out in Ecmascript 6). But I’m having trouble using private property and methods. I…
-
1
votes1
answer70
viewsPassing parameters using primitives or an object containing the fields?
When creating the signature of a method, what would be the best design option for passing parameters? Is there any good practice that addresses the signing of methods? What would be better? For each…
-
1
votes1
answer70
viewsObject orientation and meaningless values in c++
Hello, I’m starting programming in c++ and I decided to do a struct to learn and such... except that the compiler shows no error and at the end the program shows me a completely meaningless value,I…
-
1
votes1
answer87
viewsDeclare a class as attribute or implement Abstract?
You have LG branded television. in this scheme I can have different types of televisions and different types of electronics (so that the system can grow and I can use it not only for the tracking of…
-
1
votes1
answer74
viewsDoubt POO Javascript
I am practicing POO in Javascript and, looking for some examples on the internet, I came across the practice below: function Product(name, price) { this.name = name; this.price = price;…
-
1
votes2
answers77
viewsIf an A class is an implementation of an X interface, will the subclasses of A also be?
With the interface Posicionavel: package projeto; public interface Posicionavel { public boolean mesmaPosicao(Posicionavel p); public boolean mesmaPosicao(int[] x); public int[] posicoes(); } And…
-
1
votes0
answers34
viewsReturn of method messages
I recently started to study more about object orientation, but most examples are very generic and only for educational purposes. The point I am doubtful about is the return of methods. In a user…
-
1
votes1
answer52
viewsIncorrect visualization of items in POO code in C#
My code it needs to receive the values of three books that are code, title, author, publisher and value. Only that the view is confused. The impression that nome do livro 0: q // Devia mostrar livro…
-
1
votes1
answer104
viewsHow to use static property of a class in another class in PHP?
I am venturing into the world of POO in PHP and I came up with the following question. Of the four ways I used in the code below, to assign the value of $prop1 of MinhaClasse to the variable $val…
-
1
votes1
answer131
viewsHow to write a python module from a test?
I’m doing an inverse exercise on Python modules and tests with pytest, but I’m not succeeding. Whenever I run the code I get the message "E Attributeerror: 'str' Object has no attribute…
-
1
votes1
answer100
viewsArraylist in C# does not display user-typed values
I made a Arraylist in C# that shows only the name, age and course of a student . But the CS0029 error says it is not possible to implicitly convert string to paraint on line 27 and 37, before I…
-
1
votes2
answers85
viewsHow to create a property in a Javascript method
Good evening everyone, I am a beginner in Javascript, and I have a question regarding the properties. How can I create a property in a method in Javascript? I mean the methods because I’m learning…
-
1
votes0
answers49
viewsHow to display errors in the form
I’m working with the design standard (PRG) Post Redirect Get). I have 3 files 1 - Class Pessoa.PHP 2 - formulario.PHP 3 - processa_form.PHP What is the best way to handle and display errors in a web…
-
1
votes1
answer1167
viewsCreation of python Dict
Time, has a class that creates dicts and stores them in a list slot: class Pagina: def __init__(self, keys, palavras, tamanhoP): aux = list(zip(keys, palavras)) self.paginas = list() for i in…
-
1
votes1
answer38
viewsCan’t find the class that is in the same folder when trying to create a new object
Error give on line 13 of index.php when I try to create a new object "$c = new controleremoto" says the class doesn’t exist. I’m new to programming and I’ve tried everything, changed folder, I’ve…
-
1
votes1
answer24
views(Java) Error while continuing to traverse TXT lines
good night! I need that even if it reaches the condition total_min < 720 He keeps going through the lines. The 720 are the total minutes before lunch, when reached should separates the activities…
-
1
votes1
answer50
viewsWhat is the behavior of two anonymous functions in an object?
Explain: StarGate = {}; StarGate.c = {}; StarGate.c.m = function(t, e){ return "teste1"; },function(g){ console.log('teste2'); }(StarGate.c.m.prototype); I have doubts because, what would be the…