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.)

159 questions
0
votes
2 answers

Should you use member variables or property getter/setter?

Possible Duplicate: What is the difference between a field and a property in C#? I routinely have a need to create protected variables in my class/subclass hierarchies. However I keep seeing others implementations which use a simple get/set…
Mark A. Donohoe
  • 23,825
  • 17
  • 116
  • 235
0
votes
1 answer

Member variables being re-initialised after MessageBox?

I have a Form which has code similar to this: public partial class Form1 : Form { private int m_var1; private int m_var2; string sMsg; bool bReturn; private bool MyFunction() { // POINT A: at this point m_var1 and…
CJ7
  • 20,640
  • 59
  • 173
  • 305
0
votes
1 answer

Web user control member variable not accessible when not declared static

I am creating a web user control using C# to play some .wav files in the server. Following is my code. public partial class WaveFilePlayer : System.Web.UI.UserControl { //private string[] files; private static string[] files; protected…
manas
  • 400
  • 6
  • 24
0
votes
1 answer

Mapping of the members variables to iterate

In my C++ / QT application I've got a struct with hundreds of variables organized like below: struct MyStruct { int a1; double a2; struct InnerStruct { int b1; bool b2; struct InnerInnerStruct { …
sithereal
  • 1,636
  • 9
  • 15
0
votes
1 answer

defining member variables inside an array operation

I was wondering if it is bad convention to declare my member variables inside an array that I later use somewhere else (in the code below, I pass into the insertArray() function). Here my code: class myClass{ private $ID; private $name; …
rafiki_rafi
  • 1,045
  • 1
  • 8
  • 26
0
votes
1 answer

Is @fname similar to invoking this->fname in other languages

Let's use this class definition as an example: class Person def fname @fname end def fname=(fname) @fname = fname end def lname @lname end def lname=(lname) @lname = lname end end Just trying to connect the dots…
stanigator
  • 10,102
  • 32
  • 88
  • 126
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,039
  • 1
  • 22
  • 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
  • 2,131
  • 10
  • 25
-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
  • 143
  • 1
  • 3
  • 10
-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,928
  • 2
  • 19
  • 18
1 2 3
10
11