Skip to main content

All Questions

Tagged with
-2 votes
2 answers
83 views

How can I "globalize" struct methods?

I have a struct/class and i want to call some (or all) of its methods globally (without writing class_name::func_name() every time. I don't know what to replace on the using namespace foo; line. I ...
midi's user avatar
  • 7
0 votes
1 answer
24 views

How to distinguish the class member from global variable with the same name in Dart?

I am trying the following code: String user() { return ""; } class Foo { String user; Foo() : user = user(); // <= error here } void main() {} But it doesn't work because of name ...
Andrey's user avatar
  • 6,229
0 votes
0 answers
86 views

I am unsure why global variable won't update when accessed in class

Global variable will not update after I update the global variable within the function setProdID inside of the class Product. I add 1 to it, to make a new Product ID but it always stays at 0, then 1 ...
Bailey's user avatar
  • 13
0 votes
1 answer
274 views

Global variable in python with image processing

how can i make vehicle_count as a global variable so i can call it on the file class it has a use of car counting with opencv class Vehicle_Counting: def __init__(self, window): self....
cj_123's user avatar
  • 1
-1 votes
1 answer
63 views

global function and class reference

I want to send integer value in class to global function from main. How should I send it as a parameter,I am sending the parameters wrong Tetris { private: int num; } printBoard(Tetris &t); ...
nwer's user avatar
  • 1
0 votes
0 answers
135 views

Caching in python

I am trying to create a cache array that my function can modify and access multiple times. I can achieve this using global variables: def func(): global cache cached_data = cache.get("...
ugo_capeto's user avatar
-1 votes
1 answer
856 views

NameError: name 'rank' is not defined even though i have mentioned it in global

The code below is a simplified version of a bigger code. The main action i want to perform is to use and change rank and progress inside the inc_progress(self) function. class User: rank=-8 ...
Rolling Happy's user avatar
0 votes
2 answers
785 views

Android create global variable which holds its state

I have an application in that whenever the internet connectivity changes , I need to make some variables in another activities unclickable. Since internet connectivity might change in the first ...
Saneen K P's user avatar
1 vote
0 answers
309 views

Qt C++ How to create a global dynamic Object?

This problem has been bothering me for 2 days, I don't know how to implement it, thanks in advance I Have defined 3 class Equipment, Equipment1 and Equipment2. Equipment is the base class and the 3 ...
Xinhao Liu's user avatar
0 votes
1 answer
237 views

Assigning values to variables using for loop

I want to create variables that hold the values packet.{name of the variable}. For example, I want sectID to get the value of packet.sectID. I've tried: lst = ['sectID','MP_Sector_ID'] for field in ...
Phiisnotdead's user avatar
-1 votes
1 answer
46 views

How to pass the language information between actions? [duplicate]

Similar questions exists - I've tried already some solutions from StackOverflow and Google but still no luck - I can't catch a right syntax or right understanding - so let me repeat my question with ...
Serge's user avatar
  • 689
-1 votes
1 answer
36 views

When a function is called in another function why does global not function as it should?

I have a program written like this class test: def test2(): def test3(): global tester print(tester) tester = 'working' test3() test.test2() I am fully ...
Brecht Corbeel's user avatar
0 votes
1 answer
47 views

using globals() with class method in python

class MyModules: def Play_Music(self): print(123) function_name = 'Play_Music' this is a simplified code. I need to call this function with a globals() function, like globals()[function_name]...
Rio 51's user avatar
  • 3
2 votes
1 answer
421 views

Storing Objects assigned to user while using Flask [duplicate]

I come here to ask you a question about the way session can handle Objects in Flask. I have a Flask application and I want all my users to have their own object Web_Attributes (this is basically a ...
Strauss Alexandre's user avatar
0 votes
1 answer
40 views

Is there a way to convet a user's input string into a class method name in python?

hi I've recently started working with classes in python and there is a code which I must use class for converting temperature scales . for example you choose two scales and give the temp in the first ...
TCz Crj's user avatar
  • 13

15 30 50 per page
1
2 3 4 5
14