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.)
Questions tagged [member-variables]
169 questions
0
votes
1 answer
Derived class instance in the base class
This is the code I'm trying to understand. It has no specific use. I'm just trying to understand what happens.
#include
using namespace std;
class derivedClass;
class baseClass
{
public:
int objID;
derivedClass* dcObjPtr;
…

madu
- 5,232
- 14
- 56
- 96
0
votes
1 answer
Printing out uninitialized member variable. With and without default constructor
So I have the following code:
#include
using namespace std;
class baseClass
{
public:
int objID;
/*baseClass()
{}
*/
};
int main(int argc, char** argv)
{
baseClass bcObj;
cout << "bcObj.objID: " << bcObj.objID…

madu
- 5,232
- 14
- 56
- 96
0
votes
1 answer
Part of an object or reference
Assuming a class A has a member variable(which is an object rather than a reference) m. Naturally I will think that:
When I defined an object 'o1', then the Expression 'o1.m' is an object type either;
When I defined a reference 'q1', then the…

unituniverse
- 85
- 6
0
votes
2 answers
Is it possible to get all member variables in flash(AS3)?
I am trying grab all the member variables in AS3, and then foreach one i would like to process it in various ways. I would need the name and then if it is a collection of some type I would like to loop through that collection as well. I am…

Parris
- 17,833
- 17
- 90
- 133
0
votes
1 answer
First Dimension Unsized Class Member
I have a class I'm converting:
class MyClass
{
public::
void foo( void )
{
static const char* bar[][3] = { NULL };
func( bar );
}
};
Now I want to make bar a member variable, but because the first dimension is unsized I…

Jonathan Mee
- 37,899
- 23
- 129
- 288
0
votes
0 answers
Copying from global variables to class members - C++
I have multiple threads that instantiate the same class. I have NO concurrency problem. My question is performance-wise.
I have realized that accessing global variables sometime make a notable difference in performance. Why is that? ans what is…

Computer_guy
- 807
- 2
- 11
- 19
0
votes
1 answer
Template Fn Pointer error C2146: syntax error : missing ';' before identifier
I am facing a problem with templated member function pointer. The code is as shown below.
#include
#include
template
struct method_ptr
{
typedef void (T::*Function)(std::string&);
};
template
class…

TechTotie
- 127
- 1
- 15
0
votes
1 answer
Using user input for searching object in java
When creating e.g an address book I also want a method for searching it.
Imagine I go for an object like this:
public class someone {
private static someone [] addressBook = new someone[150];
private String firstName;
private String…

Avigrail
- 321
- 2
- 4
- 14
0
votes
1 answer
Audiolib.js: Changing values of existing "objects"
so I looked into Audiolib.js and can make some basic stuff but what I don't know and can't figure out by searching through the internet.
The question is how I can change specific values of some "objects" without "re-appending" it. For example:
var…

ruhig brauner
- 943
- 1
- 13
- 35
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
- 28,442
- 25
- 137
- 286
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
- 22,579
- 65
- 193
- 321
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
- 397
- 6
- 25
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,656
- 9
- 16
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,177
- 2
- 11
- 27
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,768
- 34
- 94
- 129