Questions tagged [class]
A template for creating new objects that describes the common state(s) and behavior(s). NOT TO BE CONFUSED WITH HTML CLASSES OR CSS CLASS SELECTORS. Use [html] or [css] instead.
class
79,877
questions
0
votes
1
answer
49
views
How to loop through function and value of different class in c++ [duplicate]
So I am trying to basically do a* on a task planner, coz action typically have cost(risk, time, resources spent etc) and reward(effects) so I want to put it as an a* problem but for that I made each ...
0
votes
0
answers
64
views
In C++, when is it better to use a class with a state and an "execute" method, vs just a function? [closed]
My question is about code design in general, but consider the specific context of a numerical integration tool.
Option 1: a class with a state, setters, accessors, and an execute method.
class ...
1
vote
0
answers
20
views
PHP 7.4 is ignoring incorrect parameter passing [duplicate]
I have the following class with the following constructor:
class Film {
private string $name;
private int $releaseYear;
private string $genre;
private array $notes = [];
public ...
0
votes
0
answers
36
views
Why JavaScript external classes doesn't work? [closed]
I'm learning JavaScript
I reached Classes, and I don't know why when i'm coding JS in external ".js" file and linking that to my HTML it doesn't work but when i do this in html (internal), ...
-1
votes
0
answers
27
views
How to see if arraylist of a class contains a specific value [duplicate]
I am working on a java project, I have an ArrayList of a custom class with two variables (a boolean and char) I need to check if it contains a specific char. How do I get it to check the char of it.
...
2
votes
1
answer
19
views
multiple association classes on the same relation
I want to add multiple association classes on the same relation, to manage absence and group affection between a student and course, I read that an association class is a description of a relation, so ...
1
vote
4
answers
55
views
How to change the class of elements in a list?
I have a string for input with comma seperated elements. - marks = 'marks1,marks2,marks3'
Using split function I got list of marks. - marks = marks.split(',')
This gives us 'marks' a list with ...
0
votes
1
answer
30
views
What is the best approach to handle class instances in django application in a production environment?
I would like to consider 2 approaches. First, you could create a class and its instance in a class and inside views import the instance and call its methods. Second, you import the class and create ...
0
votes
1
answer
50
views
R Class Method Without Object Creation
In R Reference class, it seems a class object must be created before using any of its methods. Is there a way to avoid object creation, like in Python, at least for cases which the reference class has ...
1
vote
1
answer
34
views
Why not reuse a class name for an instance of the class in python? [closed]
I want to get singleton/module-like behavior without the hassle of imports. Are there any issues with just creating a class and then reusing its name to prevent other instances of the class?
For ...
-2
votes
0
answers
76
views
Are there objects for primitive data types? [duplicate]
If the object represents a data type, is the variable for a primitive data type like an integer also an object representing this type, or do objects not represent primitive data types?
// Let's assume ...
0
votes
0
answers
44
views
Python multiprocessing pool with class objects
This code is runnable
I get an empty array "link"
although I should get an array with objects in it,
when I print link in func_b it is not empty
Self should refer to the object, but I guess ...
1
vote
0
answers
46
views
How am i able to change constant class member? [duplicate]
I came up with the way to change members of constant class and i don't have an explanation for it.
I came up with this example of code:
#include <iostream>
class Cool_class
{
public:
int ...
0
votes
0
answers
17
views
What is a "responsibility" in the single responsibility principle?
I'm taking a course on C# programming here: https://www.udemy.com/course/ultimate-csharp-masterclass/?couponCode=KEEPLEARNING
In it, there's a lecture on encapsulation. The instructor gives an example ...
0
votes
1
answer
41
views
multiple `thisArg`s with module function?
There are lots of questions on here about this, but "multiple this args" is getting me answers about how to declare multiple properties under this, which isn't what I'm after. If this is ...