79,770 questions
Advice
1
vote
9
replies
116
views
If a beginner asks you about the object, how do you explain it?
What if a beginner asks you a question about an object? How do you explain it? How does it work? What is the difference between a class and an object? Give a real-world example of an object.
0
votes
2
answers
105
views
How to wrap a concrete subclass within the abstract/final design pattern
I'm using the equinox library for a project, written in python.
This library is used to define dataclasses and strongly recommends to use the abstract/final pattern when designing these classes.
I ...
Best practices
0
votes
4
replies
124
views
Calling a method from another instance of the same class
I'm designing a cable tester. Each core of the cable is represented by an instance of a class cableCore, which drives a stimulus to the core under test using the method selectCore(), and measures the ...
Best practices
0
votes
15
replies
206
views
Finding out the "one line" operation between objects of the same class
How can I detect in a class that a copy operation is being performed between members of the same class? Is this even possible? I have a class that works perfectly, but with a slight drawback.
#include ...
-2
votes
0
answers
57
views
Static templates in a class [duplicate]
I'm trying to define a static template function in a class, but I get an unresolved external symbol error when I try to use it.
I am referring to this article
static template functions in a class
In ...
Advice
0
votes
1
replies
47
views
Would this be good as a new placeholder?
Generally, we either use foo/bar or a, b and c stuff, but there isn't much attention to class ideas.
I suggest this:
class test {
constructor(a, b) {
this.a = a || "Hello"
...
0
votes
1
answer
81
views
Problem with the function remove in a class function
this is my first question in this website.
the problem is, i tried to adapt a function of python 2 to python 3.14, the function is eliminaCarta, that take a class named carta and delete this carta for ...
1
vote
3
answers
224
views
no match for call to '(student) (std::string&, int&, int&)'
I'm trying to create an array of class student that I initialize later:
#include <iostream>
#include <string>
using namespace std;
class student{
private:
string name;
...
1
vote
1
answer
87
views
How to validate attribute relative to another when instantiating class
From this answer and similar blog posts I've used the decorator method to do data validation when creating a class. But now I need to validate one attribute relative to another. E.g.:
class Planet:
...
1
vote
1
answer
76
views
Trying to build a To Do list project and when trying to add list items to my project it keeps duplicating
Hi I am a beginner to coding and I am trying to build The Odin Project To Do List . I have been stuck with this code for 2 days and this is my first time ever asking for help on a forum so please do ...
Best practices
0
votes
3
replies
59
views
Class inheritence vs one class being element of the another
Suppose we have two classes A_class and B_class. We want to connect them in a way that allows to access methods and data of B_class from A_class .
We can do it through inheritance:
class A_class : ...
Advice
0
votes
3
replies
61
views
Review of my UML class diagram for a student social network (database design)
I am designing the database for a student social network web application as part of a university project.
I created a UML class diagram that includes entities such as users, publications, comments, ...
1
vote
1
answer
141
views
Create a custom cast (that also accepts $null)
(Continuing from: Cast to custom class in PowerShell) I would like to build a custom cast like:
class CheckBox {
[Nullable[Bool]]$NullableBool
CheckBox([Nullable[Bool]]$NullableBool) { $this....
Best practices
0
votes
10
replies
84
views
Indicate to Python user that the __init__ constructor should only be used by the class
I have this design for the following class:
class MyClass():
a = None
b = None
def __init__(self, a, b):
self.a = a
self.b = b
@classmethod
def init_from(cls, c):...
1
vote
3
answers
70
views
Assigning abstract attributes through the constructor in a `jax` python dataclass
I'm trying to subclass the AbstractWrappedSolver dataclass from the jax library diffrax. The class has this definition:
class AbstractWrappedSolver(AbstractSolver[_SolverState]):
"""...