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
votes2
answers219
viewsError using $this in static function
I’m trying to use a class function as follows: $database = database::select("SELECT * FROM eventos"); When I run the code, it returns the error: Fatal error: Using $this when not in Object context…
-
0
votes0
answers60
viewsHow to define better names for system entities?
How to define better names for entities in my system. I have a user table. And I have a reset password table where I relate information from the password reset process (id, hash, expiration…
-
0
votes1
answer48
viewsCan I use a function in the declaration of an attribute in PHP?
Hello. You can do something like: class Net { public static $ip = getenv("REMOTE_ADDR"); } Take the return of a function and assign directly in the property? Or create a variable outside the class…
-
0
votes0
answers164
viewsWhat are php ->, => and :?
What are the operators for: -> (less with greater than) => (equal to greater than) :: (two-point) And what’s the difference between each.…
-
0
votes0
answers81
viewsWhen and why should a static method be used?
I always had this question about the POO, I see many codes with Static methods and now starting in C# is no different. Being direct, when you should use this type of method, why use it and its main…
-
0
votes1
answer51
viewsMultiple automatic wheres
I was seeing in the CodeIgniter that there is a way to insert several 'Where' into the class DB: Example: $this->db->where('id', 1) ->where('name', 'Jão') ->where('lastname',…
-
0
votes1
answer106
viewsWhy is the description variable leaving null?
I don’t understand why the variable descricao not producing the values. In this case, it should go out like this: Old charger connecting two-pin connector socket But it’s coming off: Old charger…
-
0
votes1
answer91
viewsJavascript Class Implementation
Guys, I recently developed a game of raisin or repassa procedural (the code is ridiculous). I’m trying to improve it to put in my portfolio. I’m trying to implement with object orientation, would it…
-
0
votes1
answer219
viewsA subclass or daughter class inherits the interface of its mother class as well?
Following the pillar of encapsulation proposed in POO I arose the following doubt, when it is declared a daughter class, besides inheriting attributes and methods she also inherits the interface of…
-
0
votes1
answer33
viewsClass incompatible with the interface
I am trying to modify some methods of the class in the subclass but I get the following error: Fatal error: Declaration of Filme::create($name, $year, $poster, $description, $genre, $trailer,…
-
0
votes2
answers100
viewsI am not managing to modify the value of the Book class that is a Book
I’ve done everything and nothing of the value be modified... how do you do? I used inheritance in the physical book, the class is like this: class Livrofisico extends Livro{ public Livrofisico…
-
0
votes2
answers111
viewsHow to reuse data in a class without having to repeat this data?
How to reuse $dados, $key and $postFields in all methods without having to repeat this data every time within each method? Yes, these variables will always have the same values. class AllImoveis {…
-
0
votes1
answer706
viewsHelp with "n" primes algorithm in an Arraylist
Please I need urgent help, how to fix my code? every time I call the right error method,I am beginner and am locked in an exercise that requires primes based on a number n(in this case this.n),for…
-
0
votes1
answer174
viewsPopular Datagridview with Entity Framwork
I have in SQL Server a database called STORE; In this database I have a table called Funcio, it contains 5 columns and they are respectively: Name, CPF, Date, Date issued, Idfuncionario. In my C#…
-
0
votes1
answer1214
viewsWhy use getters and setters in classes?
Because I need to encapsulate the entire class, if, as a programmer, I know perfectly how to use that variable. I only see need for setters and getters that work the variable value, so: void…
-
0
votes2
answers9527
viewsSet Difference and Get in object-oriented programming
What is the basic difference of set and get in object-oriented programming?
-
0
votes1
answer140
viewsDoubt about data return in PHP POO
I’m learning about object-oriented programming in PHP, classes, hierarchies and so on. Reading a few topics right here on stackoverflow I found the solution to my problem with the user control…
-
0
votes1
answer533
viewsIndefinite reference in C++
I’m studying c++ and found a problem when working with object orientation, I followed some tutorials but it didn’t work. Bill. h #ifndef CONTA_H #define CONTA_H #include <string> using…
-
0
votes1
answer55
viewsDouble entry in the database?
I’ve been through my code and I can’t find the reason he’s adding two records to the database. Function: public static function create($table, array $params) { $key = array_keys($params); $value =…
-
0
votes2
answers559
viewsAlgorithm that reads three numbers and displays the result of the sum of the first two and multiplied by the third
Follow my code below, however does not return correct the result, if I put as input 2, 2, 3 was to appear 12, but appears 6 public class Exercicio2 { @SuppressWarnings("unused") public static void…
-
0
votes1
answer1048
viewsEncapsulation and Get and Set methods
I am continuing my studies in object-oriented Java programming. I am currently studying encapsulation and methods get and set and I came across the following exercise: Encapsulate the value…
-
0
votes2
answers86
viewsChange type of return
How do I change the return type of a mother class function in the daughter class? For example: class Mother { public: void Get() {} }; template <typename Type> class Child : public Mother {…
-
0
votes2
answers303
viewsProperty of a method in another method
I have been researching about the problem, but I couldn’t solve it. I’m starting with object-oriented PHP and I’m having a question class Correios{ public $nome_do_user; public function…
-
0
votes1
answer52
viewsCreating C# method, where do the parameters contain?
What is the point of adding "?" in front of the parameter variable? Example: public void somar(int n1, Date data?){ } OR public void somar(int n1, Date? data){ }…
-
0
votes2
answers34
viewsUse start and end parameters without using the middle ones. PHP
Good night! Imagine that I have a Function with some parameters set as null: public function Usuario($Nome = null, $Idade = null, $Sexo = null, $Email = null) { $this->Nome = (string) $Nome;…
-
0
votes3
answers86
views -
0
votes2
answers896
viewsSoftware to create documentation without using source code
I’m developing an API, very big, and I want to create the documentation, but most of the programs I found just take the documentation from the comments of the code-source, what I really want to do…
-
0
votes2
answers425
viewsClass association or inheritance?
What better way to create an association or heritage where I have the class User and the class Academic whereas Academic is a User User-class: public class Usuario { public int Id { get; set; }…
-
0
votes2
answers574
viewsInstalling and configuring Composer on my localhost
To use the local Composer I should install it in the folder where my projects are located? In case C:/Users/Me/Jobs... And as there are several projects (sites), for each one I must have the…
-
0
votes0
answers114
viewsautoload in the - php classes
It is a scheme that I am inventing since in this project I do not go by framework for being very simple, Working with MVC in the Framework (Codeigniter), But I don’t have a separate Model class with…
-
0
votes1
answer312
viewsCan PHP object orientation create any kind of website and project?
I unintentionally ended up taking a freelance project, and I wanted to be aware of whether or not I should focus on O because it’s more organized for this project of mine and even to learn. I’m…
-
0
votes0
answers85
viewsWhat would be the`Standard``in this case?
How would the Padrão MVC in that case? Well, I have a class Tipos, a class TiposDao and a formulário php to register a type. That Class Tipos would be the Model. That Class TiposDao would be the…
-
0
votes2
answers457
views -
0
votes1
answer147
viewsHow to use the Location function in object orientation
I am trying to direct the user to the panel page, when he login on the home page, but when directing gives the error below, but if I use javascript with the same path it works. Using the Location:…
-
0
votes1
answer101
viewsmethod chained in class with static methods
Good afternoon to all!!! How do I create a chained method, being it a static method? example: echo class::mymethod->$variable; Thank you
-
0
votes1
answer173
viewsDoes System Modeling Need Java?
I used structured data diagrams more than 15 years ago. In 2002 I did not use POO. I want to relearn modeling systems using POO. Do they indicate any material? I need to learn Java or just POO in…
-
0
votes1
answer207
viewsStatic modifier in an attribute
I’m wondering if the Static modifier necessarily needs to be in the same package as the other classes in my project. Example: I have a class called user within the user package and another class…
-
0
votes0
answers85
viewsAJAX with Slim Frame
Project : https://github.com/noebezerra/survey-slim I have a problem with the AJAX request ( Resources/views/templates/app.Twig ) ajax - app.Twig $('.stars-default').click(function(e) {…
-
0
votes1
answer49
viewsReturn of a function in another Class
I want to call the function data_hora_atual() in that session class: class sessao { function fazSessao($conexao){ } } class administracao { function data_hora_atual($par,$conexao){…
-
0
votes1
answer748
viewsObject reference not defined for an object instance. C# (on installation)
By the error message, it was understood that there is an object not instantiated, in which I would be making reference. Error: However, this same application works perfectly on the development…
-
0
votes2
answers55
viewsHow to adapt this function to work without needing the element ID?
I have a function and want to adapt it to work without needing the element ID (document.getElementById("slides");). I saw that there is the possibility to do this using the operator NEW but I had…
-
0
votes1
answer1148
viewsHow to set the key and value of an object creating an instance and put the values in the map?
I only know how to hashmap in a way that is creating an instance in the put method to insert values. Follow the way I do: import java.util.Map; public class Teste { public static void main(String[]…
-
0
votes1
answer41
viewsHow to use regular expression without using the Regex class?
I need to validate the input of values and strings, but I have doubts about how to use without using the Regex class, how can I get the solution? var CampoExpressao = new Regex(@"[0-9]"); Above has…
-
0
votes0
answers66
viewsAccess modifiers
It is wrong to claim that access modifiers control the attributes and methods of a class, avoiding inconsistency in values and objects ?
-
0
votes1
answer34
viewsDifference in Javascript attribute creation
What is the real difference between creating these two ways? function Pessoa() { this.nome = 'lucas' } and function Pessoa() { nome = 'lucas' } When it comes to instantiating, there will be some…
-
0
votes2
answers39
viewsHow to view class information
I want to show the values of a class but I don’t know how to access it. The result of print_r($this->order); showcase WC_Order Object ( [status_transition:protected] => [data:protected] =>…
-
0
votes1
answer123
viewsInserting items into an Arraylist does not work as expected
I need to add an item to the list 9 times, only when I print, only the data appears 12 , "Oi", "Aline". What am I doing wrong? package webservice; import java.util.ArrayList; import java.util.List;…
-
0
votes1
answer74
viewsWhere should I instantiate the objects?
In POO there is a certain degree of theory and good practice for writing classes and interfaces. They are inside folders with established nomenclatures. The class name must be identical to the file…
-
0
votes1
answer249
viewsHow to inform parameters to the parent class initializer with Python?
Hello, I’m making inheritance in python and I’m encountering the following error: Typeerror: __init__() takes Exactly 2 positional Arguments (4 Given) class A(): def __init__(self,a,b): self.a = a…
-
0
votes1
answer196
viewsError declaring an interface to the class in PHP?
I’m having trouble declaring a interface to a classe in the PHP where I’m encapsulating the entire program with namespace. I created a interface calling for Yargle in the directory Cnab\Remessa and…