Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
-1 votes
1 answer
128 views

Why is my dunder variable defined at module scope not recognized from a function scope as int but recognized as list[int]? [duplicate]

I tried to make a variable as "private" in the module using __dunder_case__ and use it in the function below. I finally changed the variable name to uppercase naming and forget about ...
Jean-Robin PEITEADO's user avatar
1 vote
0 answers
58 views

Analyzer Option or Lint Option for Flutter private variables?

I am building a very large codebase and spending many hours at a time on it. This can lead to me often forgetting to make a variable private, that could be private. There is currently no Analyzer ...
Ryan Park's user avatar
-3 votes
1 answer
941 views

Define a private variable in a header file or cpp file without using class?

Hi I have a question that, without using class, is there any other way to define a 'private' variable which can only be seen inside of a module, so that when we include different modules into a file, ...
Junyang Liu's user avatar
2 votes
2 answers
252 views

Is there any disadvantage of marking a variable or constant as private in terms of performance or something?

Is there any disadvantage in terms if performance or something by marking a variable as a private on a class or struct on Swift or view on SwiftUI? I know about the encapsulation advantage you get ...
Duck's user avatar
  • 36.1k
0 votes
1 answer
253 views

How to change a variable in a shared script, without affecting all the other game objects that share that script?

Ive been at it all day trying to solve this, because I dont want to make a separate script for every bullet, instead I want to have a single EnemyBulletMovement script, that can move each bullet in a ...
user avatar
1 vote
2 answers
45 views

How to list a simple private variable from outside a construct (closure)?

Is there any way to list a private variable outside the context of the constructor function? E.g: function Person() { let globalId = 10; this.listGlobalId = function() { return globalId; } };...
Antom's user avatar
  • 27
1 vote
0 answers
54 views

Python3 Unittests, how to prevent private class variables from carrying over between tests

I have two classes, Base and Rectangle. Rectangle inherits from base, and whenever an instance of either is created a private class variable increments (in most conditions) to count the number of ...
Maxwell Lovell's user avatar
0 votes
1 answer
61 views

private variable is still accessible from another class in C#

I have a .cs file which looks like the following namespace TarkovMapper.ClassObjects { class PointCloud_Object { public void AddPoint(PointEntry_Object point) { ...
julian bechtold's user avatar
0 votes
1 answer
342 views

Access to **private** variables of a class in Python

I understand that Python does not explicitly support private variables in a class. However, please consider the following program: class AClass(object): def __init__(self, x): self.__x = x ...
user816270's user avatar
0 votes
0 answers
110 views

What am I doing wrong? Setter for private variable does not substitute the value

I have a calculator program and in the main application, it asks the user for a number. Immediately the number should be set to the current value. My current value is a double that lives inside of a &...
Valerie Andy's user avatar
1 vote
2 answers
152 views

how to call a private class variable form an other private class in C#

there is my code how to i call the variable startX from underneath private class if any possible way on C# to call a private class variable from an other private class it may be a simple question but ...
Marynathan Judson's user avatar
1 vote
0 answers
52 views

OOP static variable standards

I am working on a project in C++ but I can see this happening in any other Object Oriented Language. I need a static variable in a class and I am wondering if the standard rules apply to static ...
TheWinterSnow's user avatar
1 vote
2 answers
213 views

Private variables inside a parent class

so in the code that my teacher gave me, it has the child call a method that returns a value from a private array. MY question is, what can a child class see from a parent class? Can it see all ...
Kyle Meng's user avatar
0 votes
2 answers
75 views

Adding to a private variable not working

I'm currently learning c++ and trying to make a vending machine! I know my code is really bad and I am sorry about that. I am trying to implement a bank and have the user take a loan from it, the only ...
Rohukas's user avatar
-2 votes
2 answers
608 views

Illegal start of expression relating to a Private variable

I was attempting to run a project that my teacher in AP Computer Science supplied us with to check our work. I have been trying for two classes to get the teacher's code to work but to no avail. The ...
jhocon's user avatar
  • 15

15 30 50 per page
1
2 3 4 5
7