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
answer129
viewsDoes Axios take long to consume the API?
Hey, guys! All right? I am starting my studies in Vanilla Javascript to study future frameworks using js. I made a small web project in which the user type the ZIP code of the residence and the…
-
-1
votes1
answer65
viewsError in assigning Try and Exception
We are having difficulty executing an activity of POO. To run the code block where the method we use displays an unexpected output (Semantic error). def acionamento(self, estado, nome_gerador): #…
-
-1
votes1
answer35
viewsI’m not being able to assign value to my attribute by my method
class Aluno: nome = "" ra = int nota_ac = [] nota_prova = float faltas = int media = float aprovado = bool def __init__(self, arquivo): self.arquivo = open(arquivo, 'r') linha = self.arquivo.read()…
-
-1
votes1
answer34
viewsFailure to update variables
I am developing a project in java, a "farm game" where there are several Tats for the character that is created. When we create a character defenimos which his class, it will influence his Stats. My…
-
-1
votes1
answer31
viewsHow to put more than one Get method along with the sql code to send the information in the bd ? Example: Put email and password
Php user. #Conexao/categoria.php include_once 'conexao.php'; class UsuarioDAO{ public function Inserir(Usuario $usu){ try{ if (!empty($usu->getNome())){ $sql = "INSERT INTO usuario (nome) VALUES…
-
-1
votes1
answer97
viewsC# Click and drag or use mouse scroll (Postmessage/Sendmessage)
I’m creating a console application, I need to scroll a certain part of the window from positions (x=350 y=240) to (x=350 y=120) (vertical scrolling), tried in several ways but could not. I also…
-
-1
votes1
answer91
viewsHow to change the attribute of an object received per parameter in a method?
I’m trying to implement a very simple example of using classes in the C++ language. Well, in short, there are two objects (cliente1 and cliente2), which represent two bank accounts. Within the class…
-
-1
votes2
answers292
viewsBasic - Java: error: class, interface, or Enum expected
I am learning POO by Java and this would be my first code, outside the classic hello world kkk. How long to compile it via bash, the following error appears: class2.java:12: error: class, interface,…
-
-1
votes1
answer35
viewsScanner not working
I’m trying to do a little programming, but the scanner doesn’t seem to be working. Whenever I put to print it returns 0 independent of the numbers, which was to return the highest number. It works…
-
-1
votes1
answer40
viewsfill arraylist with arraylist attribute information of another class
I have an Event class with an attribute arraylist<string>lista. I fill this attribute in a Telalista Jframe and use a evento.setLista("informaçao"); to add the textField string to the…
-
-1
votes2
answers184
viewsHow to access the name and address in the Customer Class, and access description and price in the Java Product Class, being in the Box Class?
I tried to use the following commands: // Requesting the customer’s name name = input.toString(); purchase[i]. getCliente(). setNome(name); // Código do produto a ser comprado, que é o endereço da…
-
-1
votes1
answer54
viewsIs it possible to inherit a limited set of methods from a super class in Python?
I would like to build a class that inherits only a few methods from the mother class, but not all. To understand what I mean, suppose I have two classes, Person and Student: class Person: def…
-
-1
votes1
answer40
viewsBug? I can’t add the parameter in Javascript
Good morning. So, on the question, I’m trying to refactor my code to OO and I have the following problem: (this is a minimum problem code that reproduces the problem) index.html <!DOCTYPE…
-
-1
votes1
answer37
viewsMysql connection within a class
Hello, I’m having a hard time making a connection to the database. To make the connection I created a class called Conexao and I am using PDO, when I need to make a select, for example, I call the…
-
-1
votes2
answers45
viewsTkinter and class
I am beginner in classes and Tkinter and am having a problem that I think is by little knowledge of me in POO. In the code below, only one label is running, neither buttons nor anything execute,…
-
-2
votes1
answer226
viewsHow to solve several errors of this code?
I typed this program from the book that addresses classes and gave error. How to solve? #include <iostream> using namespace std; class Efetua_calculo{ private: double total; double soma;…
-
-2
votes1
answer115
viewsAdding an external variable to the php class
Hello folks I am creating a class for user data and would like to know how to insert a sternal variable containing data, for example from the database: class Usuario { public $nomecompleto; }…
-
-2
votes1
answer390
viewsDoubt about construction method
Guys I started studying java and I have a question about the main method, I have a project to do and I would like to do if in the main method I can by functions and other methods as for example…
-
-2
votes2
answers202
viewsWhat is the purpose of serialization?
What is the purpose of the serialization of objects?
-
-2
votes3
answers43
viewsHow to Cast Another Class in PHP
good afternoon, I am starting now to develop in POO in PHP, and I came across a problem, I need to make a variable of one class is the type of other, how can I do? Below is the model, I’m trying to…
-
-2
votes1
answer115
viewsHow to add 2 objects and return number, in Python?
I have the following class: class num(int): def __init__(self, n): self.n = n I would like it to work as follows: A = num(2) B = num(3) A + B = 5 This is part of a much more complex personal…
-
-2
votes1
answer50
viewsPOO doubt object
I have a question about POO... Classe objeto=new Classe(); ...from what I understand, we create a variable that receives a reference from the created object. In a simple chained list when I delete a…
-
-2
votes1
answer41
viewsHow to create a class that contains a list of objects of a parent class?
I need to create a person class that will have attributes (name, age) and a group class that will contain a list of objects of the person class. However I do not know how to do the second class...…
-
-2
votes1
answer774
viewsFirst name, Last name, JAVA POO age
I have to do this: Computationally model the problem of getting the full name, age, the age in months from the name, surname and year of birth of a person. I did so but it’s not working, someone can…
-
-2
votes2
answers832
viewsInheritance and polymorphism in python
from random import randint class Nomes(object): def __init__(self, qtd_letras): self.letras = qtd_letras self.alfabeto = (('A', 'E', 'I', 'O', 'U'), ('A','B', 'C', 'D','E','F','G','H','I','J','K',…
-
-2
votes2
answers1152
viewsHow to pass data from an HTML form to a php object
Good morning, In the past articles I wrote I was mentioning that I was learning Object Orientation in PHP in the documentation itself, and now I decided to do some tests that maybe can be applied in…
-
-2
votes1
answer1928
viewsHow to invoke a method specific to a PHP class?
I created a class Pen which has the following attributes and methods: <?php class caneta { var $modelo; var $cor; var $ponta; var $carga; var $tampada; function rabiscar() { if ($this->tampada…
-
-2
votes1
answer280
viewsReceiving data in Controller
I’m trying to develop an MVC from scratch, without frameworks, however I’m having difficulties in receiving the input values via form in my controlller, I would like a help in this regard. My form…
-
-2
votes2
answers716
viewsAttributeerror: str Object has no attribute 'Confidence'
I’m developing a chatbot and I wish it would only respond if it had determined level of confidence in the answer. # -*- codding: utf-8 -*- import os import telebot from chatterbot import ChatBot…
-
-2
votes1
answer48
viewsHow to fix NULL object bug?
I am creating loading objects to perform unit tests, but the object I am working for is null as shown in the red arrow below, on line 39, and I can’t understand why this is happening, I need help to…
-
-2
votes1
answer140
viewsI can’t seem to instantiate an object
I’m unable to instantiate an object from the Student class Pupil Class public class Aluno extends Pessoa { private int matricula; public Aluno(int id, String nome, String endereco, String telefone,…
-
-2
votes1
answer106
viewsWhat can be done to improve this code?
class Curso { public List<Disciplina> disciplinas; } class Aluno { public List<Disciplina> obrigatorias; public List<Disciplina> optativas; public matricula(){ ... } } class…
-
-2
votes2
answers96
viewsHow to call a method not defined in the abstract class, but in the class that inherits it
Suppose there is a class and in its constructor it is necessary to call a function that is only defined in classes that inherit it. What is necessary for this to happen? Sample code: interface A {…
-
-2
votes1
answer128
viewsNeed to declare an attribute in __init__
I was doing a Dice in python3, so far so good. but I don’t understand why I need to put the attributes in init, being that having them or not will work in the "same way" and I can’t see a "sense". I…
-
-2
votes1
answer41
viewsHow to create an object by requesting data from the user and running from a function?
I created a simple class, I can create an object, but I’m developing a CRUD that needs to create the object from a function. Look at my example: class Funcionario: def __init__(self, nome, cargo,…
-
-2
votes2
answers48
viewsthis.Test1 is Undefined
I’m trying to move my application to the paradigm OO, but at the time of picking the value of the input is returned Undefined. I wanted to know the why that this error is made, and the…
-
-2
votes1
answer60
viewsImage reference path in Label Tkinter
I’m training POO in a personal project that I’m developing in showing a window called by a button that shows "samples" of text from a language, showing a flag and text from that language. The…
-
-2
votes1
answer46
viewsi am not managing to inherit the client class with one of the two
i create a client that will be Pfísica as I do for class Pfisica inherit from class client. class Cliente: def __init__(self,*lista,**D): self.codigo = D.pop('cod','--') self.nome = D.pop('n','--')…
-
-2
votes1
answer48
views -
-2
votes1
answer46
viewsMethod that returns False and to While True
public boolean para () { return false; } public void acao (int acao) { if (acao == 1) { System.out.println("Diga quanto quer depositar: "); Scanner sc = new Scanner (System.in); double valor =…
-
-3
votes1
answer97
viewsPHP MVC error, everything is working but there is this error message on the site
Notice: Undefined index: ok in C: xampp htdocs Olimpiada controller Controleusuario.php on line 17…
-
-3
votes1
answer202
viewsObject Orientation in C# - Inheritance
In relation to Orientação Objeto in the C#, have the following doubt: What is the difference between the inheritance of code reuse, of builders, of abstract methods, of superclasses and of…
-
-3
votes1
answer76
viewsCan someone give me a sense of how I do
Model computationally the representation of the functioning of a lamp, where it is possible to light, erase and check whether the lamp is access. I did this: class Lampada { boolean aceso = true;…
-
-3
votes1
answer75
viewsHow to instantiate an Abstract class in C#?
I know the class abstract cannot be instantiated. But I need to call it in Windows Forms and I’m not getting it.
-
-3
votes1
answer47
viewsclone array functions and objects
Make a function to clone arrays. (Tip: clone = [ ...clone ]) Make a function to clone objects. (Tip: clone = { ...objeto }) let total = 3, array1 = [1,2,3] const clonar = () => { if (total ===…
-
-3
votes1
answer104
viewsBuilder without parameters is not working, is leaving the object as null
I have a class with two constructors. The empty constructor (no arguments) is not working. Script shows no error. One of the constructors receives the parameters nome and limitedecredito; and…
-
-3
votes1
answer35
viewsWhen I run my program this error appears and I don’t know what is wrong
public class ClasseExecutoraFuncionarios { public static void main(String[] args) { List<Funcionario> funcionarios = new ArrayList<>(); Scanner entrada = new Scanner(System.in); Scanner…
-
-3
votes2
answers280
viewsUsing another class variable in Javascript
I have the following class; class Banco { constructor (agencia, conta, saldo) { this.agencia = agencia this.conta = conta this.saldo = saldo exibir () { console.log(this.saldo) } } Let’s say I want…
-
-3
votes1
answer55
viewsError using Decorator in a Setter method
I’m trying to implement a simple Python code to practice using decorators in conjunction with advisory methods (Getters and Setters), but I’m getting an error. The code is as follows:: class…
-
-3
votes0
answers15
viewsPOO python code
Someone who knows how to make that code: A perfumery company has two products in its line: perfumes based only on essences and natural ingredients and perfumes based on artificial fragrances.…