Questions tagged [member-variables]

A member variable is a member of a type and belongs to that type's state. (Contrast with a "local variable", defined inside a method.)

169 questions
0
votes
4 answers

Accessing "this" Type JavaScript Variables From Other Functions

I have an event firing and even though it's inside of the function from which I'm trying to access variables, I get Uncaught TypeError: Cannot read property '...' of undefined. So, let's say: ( function($) { $.fn.main = function() { …
Gabriel Ryan Nahmias
  • 2,135
  • 2
  • 26
  • 39
-1
votes
1 answer

How does ones code access member variables in a different stack frame

class foo { public: foo() : foo_member1(1) int foo_member1; void do_something() {foo_member1++;} } int main(){ foo my_foo; my_foo.do_something(); } Where is everything stored in the above example code? It was something I…
-1
votes
1 answer

Class objects member variables won't change when function is called

My problem is that I can not change the class members variable value, I tried everything that has come to my mind So here is the following code that is involved: if(player.getCollisionObject().isColliding(platform1)) { …
muhm
  • 1
  • 2
-1
votes
1 answer

Why are my Class member variables going missing in Python?

I made a class. I think that I create a member variable named "myTup" in the initializer/constructor. I try to make sure that I actually did create myTup by making the following call right at the very end of the initializer: assert(hasattr(self,…
Toothpick Anemone
  • 4,290
  • 2
  • 20
  • 42
-1
votes
1 answer

Can't assign an member variable address to a pointer

Layer::Layer(int LayerSize, Layer PrevLayer){ Size=LayerSize; Column=(Neuron*)malloc(Size); for(int i=0;i
-1
votes
1 answer

#define conflict with variable in .dll header file

I am using Unreal Engine 4 with some external .dll libraries. I have encountered a problem where "PI" is defined in unreal engine core code as "3.141592..." like this: #define PI (3.1415926535897932f) However, in the header file…
MrCravon
  • 53
  • 4
-1
votes
1 answer

How do I assign a member variable from command-line argument in C++?

Is there a way to assign a class member from a command line argument so that ALL objects of that class have that value (by default)? I want it by default because a member function creates a new object in the Foo class, and I don't want to make Var a…
-1
votes
1 answer

What are the importance of prefixes in member Variables?

Okay, so I am going through the Android development tutorial book: The Big Nerd ranch and I am on chapter two where it tells you that you need to have certain prefixes and not have certain prefixes before getters and setters. "What is the point of…
entropy
  • 311
  • 1
  • 4
  • 15
-1
votes
2 answers

Segmentation fault when a member variable of type std::map is not declared in all compilation units

When I declare a member variable of type std::map in one compilation unit but not the other, I get a segmentation fault when the containing object is being destructed. When I do the same with std::vector, it works just fine. It was definitely a bug…
fhd
  • 3,998
  • 2
  • 23
  • 18
-2
votes
1 answer

Shuffle only one variable of objects in arraylist

I have an arraylist filled with objects of a class. These objects have variables like x,y and a imagePath. I only want to shuffle the imagepath variables in this arraylist between the objects. So x- and y variables of the objects should stay the…
user7432713
  • 197
  • 3
  • 17
-2
votes
1 answer

Under these declarations, what types are the following expressions and are they correct?

struct place { char name[80+1]; double latitude; double longitude; }; struct node { struct place city; struct node *next; }; struct node *head; head head -> city head -> next head -> city -> name head -> next…
Jorts12
  • 37
  • 3
-2
votes
1 answer

Javascript Haxe member variables Objects

Javascript: function TeamSelection(player_id) { var playerInfo = new Object(); playerInfo["info_" + player_id]; } Haxe: hey I tried to define object like so: class TeamSelection { var playerInfo : Map; public…
Nevo David
  • 49
  • 1
  • 7
-3
votes
1 answer

C++ Initializing Member Variables that are Containers of Object Pointers

I apologize to ask this as I'm sure it's been answered elsewhere. I am trying to initialize a container of object pointers within the constructor of my class. The container is an array template, the class for the constructor is A and the object type…
-3
votes
1 answer

Are there any kind of references to a member variable?

I've tried to do a reference to a member variable, and understood that it does not work. Are there any way to do this? If not, is there a way to not constantly write "(* this)." ? #include #include class Test { private: …
Fenix FVE
  • 53
  • 4
-3
votes
2 answers

In C++ why is it that int variable can be declared as private data member of a class, but not string variable?

In C++ the following header file is legal #ifndef SAMPLE_H_ #define SAMPLE_H_ class Sample { private: int number; }; #endif But the following header file is illegal #ifndef #define class Sample { private: string…
Histar
  • 25
  • 3
1 2 3
11
12