menu

Recent questions tagged oop

1 vote
2 answers
Is it possible to adjust the operation of the method depending on the object? (W)Coded a simple thing that should show/delete/edit/create records in the database. There are two tables, similar in structure, but in the internal logic are responsib ...
by vertello77
asked Sep 23, 2021
1 vote
1 answer
image
How to create a property based on a collection of a class in another C# class? How to create a property in the SecondClass class that should be a collection of firstClass created in the Program class where we added its objects - coll1. The first t ...
by IvanS1989
asked Sep 22, 2021
3 votes
3 answers
How should the classes interact with each other? There is a service class Service, which performs HTTP requests. There is also a Pagination class that configures the pagination parameters for queries. The last clas ...
by Junart1
asked Sep 20, 2021
3 votes
1 answer
How do I use PDO in other classes? The way I see it: I write a class to connect to the database, subcontract it in the methods of other classes and there already work. How I implement: Connection class ...
by vertello77
asked Sep 20, 2021
2 votes
7 answers
Are classes possible in C? Is it physically possible to implement a structure-based oop with encapsulation, inheritance and polymorphism in C? ...
by Anther
asked Sep 20, 2021
1 vote
5 answers
Know OOP or not? Does a programmer need to know OOP? ...
by Adilet-novichok
asked Sep 20, 2021
1 vote
1 answer
image
Why is this decorator's method necessary? The source says that the decorator must have exactly the same method as the generic abstract class. Each new decorator implementing the decorator class overrides the get ...
by BitNeBolt
asked Sep 18, 2021
1 vote
1 answer
When I create a class object using the load method, how do I add a value to its property without ___construct? There is a class myClass, and the load method should create an object of that class and set the value of the property $property. If you just return(new myClass()) - it ...
by Tsybinn
asked Sep 18, 2021
1 vote
3 answers
When to use private fields when defining a class? There is an opinion that when writing a class, most of the properties should be made private, so that no one can change the internal state of the objects, thus reducing ...
by linesb
asked Apr 2, 2021
3 votes
2 answers
KISS vs SOLID, what and when to cook? Hello, everyone! Based on video about FizzBazz's JS implementation wondered what was really easier to maintain, a dozen lines of KISS ("structural approach") spoiler ...
1 vote
1 answer
How to describe the structure of a PHP object? Good afternoon, php code: $base->test('string1') ->chek('string')->hello; What would classes look like that would be able to describe such code? ...
by ilya200
asked Apr 1, 2021
1 vote
1 answer
How to use the principle of polymorphism? There is class and service: interface Search { search(): Observable<any>;}class CloudService implements Search { search(): Observable<any> { re ...
by Junart1
asked Apr 1, 2021
1 vote
2 answers
Is this code a violation of the Dependency Inversion principle? Would creating an entity object in a controller be a DI violation? An example from the symfony demo: https://github.com/symfony/demo/blob/e5e5a8fff0483... public func ...
by somebug
asked Mar 30, 2021
1 vote
2 answers
Why do we need functional interfaces in java? Why do we need functional interfaces and what is their purpose? Googling says it's for lambda expressions, but functional interfaces predate java 8. ...
by sys_user
asked Mar 29, 2021
2 votes
2 answers
As in c An example of how you can pass an unknown class to a method. public static void ReadData<T>() where T : new(){T i = new T();} It doesn't work like that anymore. p ...
by ArrayPop
asked Mar 26, 2021
3 votes
1 answer
Need help with the python code on OOP, how to ask someone on line 23 to answer a question? class Human: def __init__(self, name): self.name = name # ответ по умолчанию для всех одинаковый, можно def answer_question(self, questio ...
by mercower
asked Mar 26, 2021
1 vote
2 answers
Where's the mistake here? class error { public $error; public function setError($text,$number = 0) { $this->error'text' = $text; $this->error'number' = $number; } public functi ...
by Vlaytur
asked Mar 25, 2021
1 vote
1 answer
Output an array through a class? I have an array of holidays in the Holidays.h file #pragma once#include "Month.h"struct Holiday { const char name25; Month month; int day;};Holiday holidays = { {"Ne ...
by Leo_SAN
asked Mar 25, 2021
1 vote
1 answer
Implement a remove method in Cart class to remove products. Should the method take the name of the product to be removed as a parameter? I don't understand how I can pass the name of a product that has a getter in the Product class into the remove() method Here's my code: class Product{ private $title ...
by Annikangl
asked Mar 24, 2021
1 vote
2 answers
Declaring and Defining a Method Template? Guys, is it possible to put the declaration of a template class method in a .h file, and its definition in another file or all in one? Sorry in advance for the blunt que ...
by TopToster
asked Mar 23, 2021