Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Filter by
Sorted by
Tagged with
-2 votes
0 answers
58 views

class parent{ private String x = "Parent"; public void printmsg() { System.out.println("value is "+ this.x); } } public class child extends parent{ ...
Bhupesh's user avatar
1 vote
0 answers
20 views

I try to write an openmaya viewport 2.0 shader in maya that read couple of vec4 custom attributes on instances for the logic of the shader. Ideally bifrost instances but it can be geo instanced in ...
Kio's user avatar
  • 11
0 votes
0 answers
129 views

I would like to send emails from APEX or PL/SQL. This works if the FROM parameter is the same as our Instance Administrator has configured in SMTP. I have the email adress, but I would like to ...
Allard Hillebrand's user avatar
-1 votes
1 answer
51 views

I have a class and method that I am trying to pass a self.instance_variable as default but am unable to. Let me illustrate: from openai import OpenAI class Example_class: def __init__(self) -> ...
Legion's user avatar
  • 474
0 votes
0 answers
23 views

When using a GUI design software, an instance variable cannot be accessed outside after being modified inside a nested function triggered by mouse events like on_motion. The instance attribute stores ...
G sink's user avatar
  • 1
-1 votes
2 answers
200 views

I am not a developer, im a designer. My problem is i'm trying to figure out how to reveal more information in Storybook stories so as a Designer I can check content without having to browser inspect ...
Stuart Wilson's user avatar
4 votes
0 answers
44 views

Problem Description I've encountered an interesting behavior in Java regarding forward references in instance initializer blocks. When I try to access an instance variable directly, I get a forward ...
happy's user avatar
  • 515
-2 votes
1 answer
61 views

I'm looking for a solution that would allow me to have access to a static function that would operate on instanced values without implementing a singleton. I'm not sure it's possible, I've personally ...
Grim_T's user avatar
  • 145
-1 votes
1 answer
58 views

In Part 5 Primitive and Reference variables section, there is a Person class defined and then another class called TimeMachine which has a reference variable defined for type Person. public class ...
Peja77's user avatar
  • 11
0 votes
3 answers
1k views

class Animal: x = {} y = 0 def __init__(self): pass animal1 = Animal() animal2 = Animal() animal1.x['num'] = 14 animal1.y = 14 print(animal2.x) print(animal2.y) Output: {'num': ...
Michael Ojoko's user avatar
-2 votes
2 answers
66 views

I am basically writing static methods that perform work on a list of strings but I can't quite determine if it would be better to create instance variable and do all the work internally. In case my ...
zaxunobi's user avatar
  • 962
0 votes
1 answer
65 views

I have a class which has an internal instance of another class. @Singleton class ClassA { private var classBInstance: ClassB init{ classBInstance = ClassB() } fun ...
Sunny's user avatar
  • 3
0 votes
1 answer
69 views

In the Setter Method "setName()", int the first line, name=this.name ; takes the value of the string "nidhi" in the second line, this.name=name; what actually happens i can't ...
HappyCoderNids's user avatar
0 votes
0 answers
32 views

ABOUT ME: I am learning Java because I want to become a software developer someday and I came across the topic of subclasses and their ability to inherit from superclasses on tutorialspoint.com. where ...
Nahum Auguste's user avatar
1 vote
2 answers
117 views

I am working on optimization problems. As you know, optimization is an iterative process. Some sections are selected, and the weight of all sections is calculated. I have code like this: class Test: ...
torunoglu's user avatar
0 votes
2 answers
67 views

I am trying to create a class called trader that has instance attributes price, action and number, where action is an empty list and number is initially set to 0. Within this class, i need to define a ...
Sophie_M's user avatar
-1 votes
2 answers
101 views

I recently stumbled upon this weird behaviour of Java where a variable of type Hashset, which is declared private in the parent class, is not unique for each instance of the child. Instead, all the ...
ACP's user avatar
  • 1
2 votes
2 answers
389 views

I'm just studying python OOP, and truly confused when to use self and not. especially when I want to make a method that defaultly get object instance input and also wanna make it work as a normal ...
Jongbin Won's user avatar
0 votes
2 answers
2k views

I'm new to using java and I need to make a class called Rectangle, but the code I'm using doesn't seem to work, and the notes for class aren't helpful. I feel like it has something to do with my ...
Sheebs's user avatar
  • 15
0 votes
1 answer
218 views

I'm making a utility module that have some simple functions - I want the module to extend self so it does not need to be instantiated. A coworker and I were discussing various ways to store data in ...
Toni K.'s user avatar
  • 38
1 vote
1 answer
203 views

I am trying to avoid repeatedly passing a struct in my functions in order to access its fields. In Java this can be avoided by using a class and defining instance variables. What's the equivalent in ...
Brandon's user avatar
  • 89
0 votes
0 answers
35 views

I am unsure how to go about setting up a method in a golf Player class. This class calls on other methods of another class called ScoreCard so I will include that class here as well. Player class: ...
Alyda96's user avatar
1 vote
2 answers
64 views

I just feel like I'm not doing this correctly and I have researched and just can't seem to wrap my head around how to initialize variable that have to reference another method or class. Player class ...
Amber Lyda's user avatar
1 vote
2 answers
114 views

I am making an AI game where the cpu stacks N numbered cubes in a table in 3 rows using the Uniform Cost Search algorithm. What I'm trying to do is the generateMoves() method, which will return an ...
Stelios P.98's user avatar
0 votes
0 answers
162 views

this is bit of a loaded quesiton but thought i may give it a go. We have similar db code for diff projects so we decided to wrap Sequelize into its own module. basically, i have this format const ...
Tanner Summers's user avatar
0 votes
0 answers
60 views

Frontend I can access methods of an instance of a class by static code: instanceName.method(varValue); The class is Gauge (library SVG Gauge) and with the above code I can control the pointer of my ...
IoT-Practitioner's user avatar
0 votes
2 answers
68 views

Let's say I am working on a problem where a class object will only be instantiated once, such as a Gem configuration object. The configuration class calls many classes that use the configuration class ...
TenJack's user avatar
  • 1,642
0 votes
1 answer
35 views

I understand that the following code is allowed (I've read the previous posts on the topic), but can someone explain to me what is actually happening when this class is run? Is the block skipped and ...
Oyst's user avatar
  • 1
1 vote
2 answers
606 views

I am not sure how to design of my Java classes, the question is also related to better testing. I am using static utility class/method Utils.getMapper() to get configured ObjectMapper at many places ...
jnemecz's user avatar
  • 3,676
0 votes
1 answer
657 views

I am rendering a dynamic table in react like this: <TableBody> {finalLoadedTokensData.map((loadedToken, index) => { const isItemSelected = isSelected(loadedToken.contract); ...
Falcon Stakepool's user avatar
0 votes
1 answer
33 views

I am trying to create a new object of teacher and student but it is giving me an error. It stops giving me the error if I remove static from main but then it can't find main to run. I really do not ...
Frankenbtiz's user avatar
1 vote
2 answers
226 views

I have a class containing tensors that have an unpredictable list of properties. I would like it to generate a list of properties with getters and setter based on a list given at instantiation. Do hou ...
Xiiryo's user avatar
  • 3,287
0 votes
2 answers
68 views

I'm looking to use class objects to store data from multiple simulations and save them in a list, each entry in the list a new instance of the class). I'd like to ensure that each instance has exactly ...
Henry's user avatar
  • 3
0 votes
0 answers
29 views

I tried to run two thread of class's function, and in function use instance variable. But when I show the adderss of that instance variable, why the address of self.flag of index = 3 is different with ...
Nguyen Thanh Minh's user avatar
1 vote
3 answers
50 views

For example lets say there is a player object with an instance variable: public class Player { private final PlayerConnection connection; private final PacketSender sender; public ...
Oshino's user avatar
  • 11
0 votes
0 answers
28 views

I am not building the main program, just the class definition - so it's hard for me to check and see if my class definition looks correct. What I am trying to do: Create the class definition for a ...
unreliablenarrator's user avatar
-2 votes
1 answer
69 views

Here is my code ` class Cats: def __init__(self,name): self.name=name #print(self.name,name,"hello") def change_name(self,new_name): self.name=new_name ...
Vikrant KALKAL's user avatar
0 votes
1 answer
612 views

I'm currently try to pass the items of a list create an instance of a class. My code looks like this args = ["1", "John", "Doe"] class Token: def __init__ = (self, ...
Angry_Llama's user avatar
-3 votes
1 answer
263 views

I am a beginner of C++ with Python background. I have some ambiguity about the process of obtaining instance attributes in Python classes and C++ classes. As follows, I list two classes that have the ...
Ili a's user avatar
  • 1
0 votes
0 answers
29 views

class Atm: def __init__(self): self.pin = "" self.balance = 0 def menu(self): ask = int(input(""" Select ...
Rishabh Shrivasatava's user avatar
1 vote
1 answer
159 views

I am trying to learn the python class variable concepts, while doing so I have encountered below issue. I would appreciate if anyone can help me in understanding why this below mentioned behavior ...
shivakumar's user avatar
0 votes
2 answers
63 views

So, I have been trying to implement the following: from abc import ABC from abc import abstractmethod class parent(ABC): @property @abstractmethod def example_variable(self)->str: ...
Siddharth Das's user avatar
2 votes
1 answer
480 views

I cannot figure this out even though I watched videos about Object Oriented Programming and Classes in python. Simplified scenario: 2 classes. class1 is basically a window with two buttons (button1 ...
Alena's user avatar
  • 23
0 votes
1 answer
455 views

I want to create a Library Management System using Python 3.10.8 and OOPs approach. I want to make two Instance attributes: 1)listOfBooks :containing the list of books available in the Library's ...
CodingP's user avatar
0 votes
1 answer
103 views

I am trying to use a completion handler in a view model that assigns values to @Published variables. I get an error stating I cannot use instance members within the property initializer. I tried ...
Chris's user avatar
  • 165
2 votes
0 answers
71 views

Bank Program I have made a class Account with it's own attributes, one of which is First_Nam. Then, in my main() function I assign the value of an input object to an instance of the class Account. I ...
S-Yohan's user avatar
  • 21
2 votes
1 answer
2k views

I don't have any formal training in programming, but I routinely come across this question when I am making classes and running individual methods of that class in sequence. What is better: save ...
Fruity Fritz's user avatar
0 votes
1 answer
643 views

In a typescript class, are you able to specify an instance variable as a shortcut to access the first value in a Set? What I want to do is something like this: export class Car { public gears: Set&...
Kellen Stuart's user avatar
-2 votes
1 answer
52 views

What will happen if I define a class like below code with Swift, the complier doesn't give any errors: class Test { var test = Test() }
Peruser's user avatar
  • 11
0 votes
0 answers
87 views

I have read from a website that instance variables can be accessed directly within the class but my code below works only with object. can someone please help.Thanks in advance! public class ...
Koushik Andhavarapu's user avatar

1
2 3 4 5
31