Category "class"

How to fix/ learning help understanding basic method and classes, Java code and word Problem

I'm struggling on this problem, given that I'm probably making a basic mistake or I haven't got a clue what I'm doing. platform being a Zybook the problem rea

Typescript: how to inference class type that implements an interface

Giving an interface interface IAnInterface { } How to reference and point to a class type that implements that interface! Meaning! Giving a class: class AClas

How can I encapsulate code dealing with matrices and make it reusable?

At my course we are getting tasks that always start with filling a random matrix size nxm with random numbers. I want to create(a library?, a class?) some struc

How to create and call on a Python Class to calculate Kelly Criterion formula for sports betting?

I am trying to create a Python Class to calculate the Kelly Criterion formula in order to determine the precise bet size for an individual sport's investment. I

How does object initialization ambiguity get resolved?

The class has two constructors, one that has no initialization value and does not increase the 'val', the other takes a reference to an object, and increases 'v

What are sealed classes in Java 17?

Today, I updated my Java version from 16 to 17, and I found that sealed classes is a new feature in it. I think it can be declared like this: public sealed clas

Use dependency injection in static class

I need to use Dependency Injection in a static class. the method in the static class needs the value of an injected dependency. The following code sample demo

How can I use/inject a service in a "normal" c# class like in Blazor @inject ClassName classObject

I have a Blazor Project, in the Program.cs(formaly aka Startup.cs) I added a service builder.Services.AddSingleton<Models.UserVisit>();

searching in arraylist always not found

no matter what I use indexof() or contains or .equals() changing everything to uppercase or to lowercase It always return false and not found can someone please

How to add Screen Manager to my KIVYMD code, but not in kv file only class method

I'm new here, I have a small problem in kivymd. Is there anyone here who would be able to help me? this is my main.py file from kivymd.app import MDApp from k

Calling a native C++ method from C++/CLI

I'm developing Wordle in C++ using a .net graphic interface with visual studio. I have a file.h that contains a class "WordDatabase", and I need to use one of t

How to make the class constructor that returns the object of child class?

I'm coding in Python. I have a Base class which contains several methods. There are some child classes; they may have their own methods. I want the Base class c

Method parameter auto completion for a class instance

I am trying to get auto completion of method parameter names for class instances but can't quite figure it out. Take this example class: class Abc: def meth

Invoking a function, by traversing an array of objects

I'm using prototypal inheritance in javascript. The parent class is an animal and an example of one of the child classes is a cheetah. All of the child classes

Create a function with a class Player with values "username" set to input, "size" to 50, "x" and "y" to 0

Trying to create a function with a class Player with values "username" set to input and the rest set to numbers. Searched a few websites but the answers weren't

How can I make a list that can be accesed by other classes?

I'm trying to make a project using the standard std::list. There is a list of names that have to be accessed by multiple classes. The list has to be inside a cl

Retrieving a value in one class that is set in another

I hope you are all doing well. I've been having a small issue in a task for university, I have a variable in a class named Alpha where I want the value to be ch

How to make a tuple give a random new tuple?

I am trying to take a position (a,b) and via the code receive a random new position (a,b).. I am having great trouble implementing the code and what I got is by

Append to existing tuple in c++

i am trying to make a thing to store types in list. The best thing is to use a tuple. then to get the type i use tuple_element_t. But the problem is when append

error: type ‘class’ is not a direct base of ‘class’

I haven't been able to find an answer that relates specifically to my question. It's a bit of a "strange" case in terms of what I've seen. So I have a class C