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
votes2
answers248
viewsCall method by class or by instance?
What would be the most correct way to call a method of another class? It is more correct to create the object: private MinhaClasse minhaclasse; minhaclasse = new MinhaClasse(); To then call a…
-
1
votes1
answer31
viewsPass parameter to a get method, can it generate an error in C++?
I’m starting to study POO now and it’s a bit weird for me. But I’d like to know if I pass some parameter in a method get, can result in a mistake? Ex: class MostraNum { private: int x; public: int…
-
1
votes0
answers92
viewsHow to make inheritance with Javascript / jQuery
I have a question about how to use inheritance with Javascript / jQuery (if possible), I did a search but found confusing materials of gringos who could not help me. Let’s go to the classic example…
-
1
votes1
answer102
viewsPOO and programming languages
I see thousands of courses talking about learning object-oriented programming, but when you learn POO you can apply that knowledge in all the languages that use POO or each language has its…
-
1
votes0
answers51
viewsMy function is not checking the IF condition is already going straight into the ELSE
private int dia; private int mes; private int ano; public bool GravaData(int d, int m, int a) { if ((d > 0 && d <= 31) && (m > 0 && m <= 12) && (ano >…
-
1
votes1
answer81
viewsCalendar variable updates the other when the second is updated?
Hello, I’ve been messing with the Gregoriancalendar class and I’ve come across the following problem: You had to go from one point in the calendar to the other, then set the first point as the…
-
1
votes1
answer664
viewsHow to create one class inside the other in C++?
I need to create one class inside the other in C++ For example: I already have the Calculator class created. I need to insert the Operator class within it. How should I create it? How will the…
-
1
votes3
answers450
viewsAccess modifier protected
A common class (which is not subclass) and has no inheritance, can use an attribute protected of a superclass that has a subclass? If so, this attribute will be visible (no need to use the…
-
1
votes1
answer89
viewsInheritance in Rails
I’m starting in the area, I have the following scenario in my back end done in Rails: I want to implement a parent class: Equipment: PK ID Brand ... And some child classes Printer: ID_EQUIPAMENTO PK…
-
1
votes1
answer24
viewsWhat is the best way to take advantage of the database data for functions related to the recovered content?
When I need to use a database information for more than one task, what is the best solution for object orientation( ex:list the products of a cart and perform calculations ): 1 - Create a single…
-
1
votes2
answers849
viewsCatch instance of daughter class
I have a class: class Children extends Database Soon, Children is the daughter class and Database the parent class, in the parent class I have the attribute: protected $object = null; The value of…
-
1
votes1
answer120
viewsWhat comes after POO?
I am finishing the course of POO in Java and would like to take a doubt. So far I have not been given anything regarding how I could put a desktop development for third party use. For example, on…
-
1
votes2
answers258
viewsUse of struct in C#
I have to record customer information. And I used struct to do this. Is it worth doing this? It is or is not a good practice?…
-
1
votes2
answers283
views -
1
votes0
answers507
viewswhat is overload and overlapping methods?
In object-oriented programming it is possible to overload methods. What is and what is the overload of methods?
oopasked 6 years, 7 months ago user117732 11 -
1
votes1
answer55
viewsIs it valid for two objects to have reciprocal references?
Is this an acceptable practice or is it a gambit and shouldn’t you ever do it? Is there any solution to avoid this? It turns out that the player object needs to know what the state of the game is in…
-
1
votes0
answers24
views -
1
votes0
answers39
viewsDoubt -> Object Oriented PHP/ Standard Strategy:
Hello I have a question on how to use the Strategy standard in php. How could I type a variable in php so that it is an interface as it is done in java Waltever variavel , whose interface is…
-
1
votes1
answer165
viewsRequest $request in object-oriented PHP
I’m doing some PHP OO exercises and came across some functions that call a class before the variable. But I didn’t really understand why. For example: public function Exemplo(Request $request,…
-
1
votes1
answer262
viewsConstructor method in inheritance classes
Using Python3, as would the constructor method of the class Z? class W: def __init__(self, atributo1): self.atributo1 = atributo1 def metodo1(self): print("Metodo1") class X(W): def __init__(self,…
-
1
votes1
answer235
viewsData persistence using Event sourcing
Recently I heard about Event Soucring in a video by Greg Young and I found an idea that seems to be very useful in various systems where having a data history is important. What I understood is that…
-
1
votes2
answers220
viewsHow to pass an attribute of the child class through the constructor to the mother class
I have 3 classes Mother class: Animal Child Classes: Dog and Cat I want to save the name attribute only when one of the objects is instantiated Gato or Cachorro. In the mother class I have the…
-
1
votes1
answer129
viewsError: expected class-name before
I’m developing a project where I have an online class that inherits from an X class, where this X class needs to give a new on an online class object. When I do this error happens due to inheritance…
-
1
votes1
answer374
viewsHow to order a table using Collections?
I’m developing an application similar to the Olympic medal board. I’ve done the classes and the table with the countries and their medals. Now I’m hooked on the part I need to organize the table by…
-
1
votes1
answer194
viewsSelecting multiple fields from a table with a term in the query
I tried to follow some steps I found here in the bad forum did not work... I have this code here in the codeigniter model: // buscando clientes $this->db->like('nomeCliente',$termo);…
-
1
votes0
answers132
viewsAdding values of 1 Mysql Column with codeigniter
I need help fast. I am trying to create a function in Models, where only add the values of the 'value' column of a table. I’ve researched several questions here and I’ve asked them, but they’re not…
-
1
votes3
answers209
viewsCan the "main()" method be overwritten or overwritten?
I read the answer What public Static void main(String[] args means)?, but I still have two doubts about the method main(): The method main() can be overloaded? The method main() may be…
-
1
votes1
answer154
viewsFPDF Adding Page to More
My document only came a record, but it still generates two pages the function I’m using is this: function Footer(){ // CRIANDO UM RODAPE //$this->SetX(15); $this->setY(-15);…
-
1
votes1
answer181
viewsHow to insert multiple rows of a single query using the same ID
I’m trying to make multiple Inserts using the same ID with the Laravel but it is doing only 1 Insert. The idea would be something like this. ped_cod|est_cod|ped_qtde 8 |2 |9 8 |3 |2 8 |4 |2 8 |9 |15…
-
1
votes1
answer83
views -
1
votes2
answers489
viewsWhat are the differences between Value Objects and entities in object orientation?
I would like to know the differences between the concepts of Value Objects and entities in object orientation. NOTE: The question is not whether the use of these concepts are good or not, the doubt…
-
1
votes1
answer228
viewsWhat is the difference between the behavior of a static method, normal method and class method?
I’m studying python with OOP and sometimes I feel confused when using a certain method. class MeuObjeto(object): def __init__(self, objeto): self.objeto = objeto def metodo_normal(self): //sem…
-
1
votes2
answers144
viewsRedudancia interface with Disposable
I saw an example of implementing a interface with Disposable which I think is redundant and I would like to know whether I am right. Following example to illustrate: public interface…
-
1
votes1
answer111
viewsWhat is the difference between the constructor method and the use of setters in Javascript object orientation?
The question may seem a little crude, but I was left with doubts and I would like to understand more deeply. The constructor feeds the created class objects, correct? Doubts are: So what use is he…
-
1
votes2
answers101
viewsWhy doesn’t this work in Javascript?
Why can’t I declare an "address" variable at the beginning of the class definition? And how the JavaScript can declare class variables using only this.nome_variavel? class Pessoa { var endereco;…
-
1
votes1
answer57
viewsDoubt About Socket logic
I have a question regarding identifying socket. Let’s assume I have 2 "socket types", a customer and an attendant. Where the 2 chat is done, I can have several clients and several attendants, but my…
-
1
votes0
answers98
viewsAccess VUE data model by another script
Well I have a data model with the following information in vuejs graficos: { data : { labels: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri'], series: [ [5, 2, 4, 2, 0] ] }, options : { width: 600, height: 300…
-
1
votes1
answer129
viewsConceptual doubt. Entity Framework, BLL and OOP
People, I request urgent help... I have a system that is running "right". Done in C# (Winform) and SQL Server (no Entityframework). However, due to studies and the need to expand the system (adding…
-
1
votes1
answer207
viewsInstantiating an entity within another entity: how to do it?
The class Estado depends on the class Pais. What would be the difference between me doing this: And do this? I mean, what’s the difference between me instantiating the class Pais within the class…
-
1
votes1
answer100
viewsBest object-oriented way to solve the problem
Suppose I am modeling a Paycheck. However, each entry in a Paycheck I chose to model as a ItemContracheque. That is, to represent my Paycheck as a whole, I can use a simple list of ItemContracheque.…
-
1
votes1
answer126
viewsInheritance problem with HIBERNATE
Well, my problem is this, I have an abstract class Official and two subclasses Attendant and Dentist inherited. I also have a class User, which has as attributes login, ... , .... , ... and an…
-
1
votes2
answers229
viewsWhat does the PHP "new" actually do when instantiating a class?
I have a class called Setup with some static methods. But I’m having trouble understanding something that happens. I use the class methods as follows: Setup::$getMetodoX so far so good. However to…
-
1
votes1
answer2019
viewsHow do I get the size of a Java String?
I’m creating a fake bank in java but I don’t know how to check if the password has 8 characters. public void criarSenha(){ String senhacriada = (JOptionPane.showInputDialog("Qual a senha ?"));…
-
1
votes1
answer70
viewsError: Exception has occurred: Typeerror (Python)
I have the following error when compiling: Exception has occurred: TypeError __init__() missing 2 required positional arguments: 'usuario' and 'senha' What I’m doing wrong? class Login: usuario =…
-
1
votes1
answer1023
viewsCall to Undefined method PDO::bindParam(), how do I fix it?
I’m starting OO studies and decided to take a look at the PDO, only it’s not working. Help me, please: <?php class Cliente { private $nome; private $email; private $telefone; protected $cpf;…
-
1
votes1
answer141
viewsMenu with Polymorphism
I’m creating some examples to learn polymorphism more deeply, but in the original code, all functions work correctly. Original code: #include <cstdlib> #include <iostream> class Mamifero…
-
1
votes1
answer362
viewsSplit the table in two?
I have a table with 25 columns (counting the FK) and two groups of users, one will access only 10 columns and the other will access almost all. Because I thought I had many columns in a single table…
-
1
votes1
answer90
viewsOperator overload = in c++
I’m having a problem implementing operator overload = in a heap class. Heap& Heap::operator=(const Heap& outro){ printf("chamei atribuição\n"); this->escreve(); Heap *h = new Heap(outro);…
-
1
votes1
answer418
viewsFrame Replication [Error: Component already exists]
I have a form in Delphi and I wanted to have a pre-created frame added dynamically several times by clicking a button. I’m trying through this code: procedure TMain.Button1Click(Sender: TObject);…
-
1
votes1
answer369
viewsManual authentication of a table field in the Laravel Framework 5.3
I’m starting now with the Framewok Laravel 5.3., however quado crio with artisan o make:auth it automatically creates the views, model, and controllers concerning Login. Only I added a field to…