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
2 answers
Catching undefined value accessing in Perl
How can I catch access to member variables?
$Class1->{Class2}
If the Class2 field doesn't exist, is is possible to catch this from an internal function?

user2309843
- 243
- 1
- 17
0
votes
0 answers
How object member's address is figured out on a method call?
I know the question is a bit generic but I need a generic answer already. So the thing I'am trying to understand is how an object's member variable is accessed from the memory point of view, for example, when a method is called on that object?
For…

stdout
- 2,471
- 2
- 31
- 40
0
votes
0 answers
C++: Member variable order with sockets in WinCE7
I'm writing a program for WinCE7, and I'm trying to setting up a static library class that will be used by the program for TCP communication. Different member variable orders, thus, stuck the program in different ways. Parts of the…

Giack
- 1
- 2
0
votes
3 answers
Should a specific proportion of members be shared between base and derived classes?
I'm currently designing the classes for an application I'm writing for my coursework, and I have two classes that sound as if they should be a base-derived class pair, and do indeed share two member variables, and my problem is that they each have…
user360907
0
votes
3 answers
Default value for a c++ class member variable : referring to it later
I have a class C having member variables such that each, when not set, must be set to a default value. I have a lot of member variables in C, and various constructors that set some variables and do not set others etc, so that to be sure that the…

Olórin
- 3,367
- 2
- 22
- 42
0
votes
2 answers
How to add statement if-else?
How to add if-else statement for "kodeprodi"?
Everytime I add if-else statement, the message "Lvalue required" always appears.
#include
#include
#include
#include
typedef struct {
char bp[13];
char…

Raka Doank
- 21
- 2
0
votes
1 answer
Can I trick access to private C++ class member variables?
Possible Duplicate:
Accessing private members
Is it possible to access private members of a class?
Is there a good (yes I know this is ugly) way to hack to the private data members of a class?
One brute force approach is to copy the header file…

WilliamKF
- 41,123
- 68
- 193
- 295
0
votes
2 answers
C++ - Internally, when defining a class's member functions, should the member variable name or its getter function be used?
I apologize if the question title doesn't effectively (or at all) reflect my actual question; this is my first time asking or answering on stackoverflow and may have goofed...
Anyway, my (elaborated) question is this:
When defining public member…

Steven94
- 70
- 1
- 7
0
votes
3 answers
Parent-child relationship set to member variables in Qt
I was reading Qt Documentation here. I found the following sentence under the title 'Thread Affinity'.
Note: A QObject's member variables do not automatically become its children. The parent-child relationship must be set by either passing a…

Hareen Laks
- 1,432
- 2
- 17
- 33
0
votes
2 answers
Accessing member variables with a pointer to a class
I'm having some trouble here, using C++ regarding access to a member variable via a pointer.
Say I have the following class, and it has some output and a unique tag.
class CSource
{
public:
int tag;
double output;
}
I want to store a…

holy_city
- 1
- 1
- 2
0
votes
1 answer
C++ Static Struct Member Variable Efficiency
I wrote a class that contains 5 static member variables. I can improve the organization of my code if I group the 5 members variables together in a struct, then statically declare the struct in my class. However, would the extra dereferencing to…

PentiumPro200
- 641
- 7
- 23
0
votes
0 answers
Best way to save file in a class
I'm currently writing on a File_Handler, a class that simplifys operations on files which I need for my program.
My question is which way would be best to save the file in my class. Would it be best to save the path of my file as a std::string and…

Aemmel
- 122
- 2
- 6
0
votes
3 answers
How to access a structure variable inside another structure?
I have two typedef struct in header file.
typedef struct {
int fallLevel;
unsigned long lastStepTime;
} PlayerFallStruct;
typedef struct {
int id;
char* name;
int x;
int y;
PlayerFallStruct playerFall;
} Client;
I…

coupraes
- 21
- 1
- 1
- 3
0
votes
1 answer
php classe: problem getting value from function into a member variable
I have a function that gets a value from the database and returns it. I call the function to store it into a member variable but I get the following error:
Parse error: parse error, expecting `','' or `';'' in I:\wamp\www\deposit\classes\Site.php on…

Christophe
- 4,798
- 5
- 41
- 83
0
votes
1 answer
The Member Variable in java is GC root it?
I see a lot of explain about what is gc root.And i know local variable and params is gc root.But member variable is not gc root? If i type code in class body
Person p = new Person("Lily");
public void sayHello(){
…

Snow Albert
- 547
- 7
- 15