Questions tagged [member-access]
63 questions
0
votes
2 answers
Allowing access to a base class member from a particular derived class
In a project, I have a class hierarchy implementing a graph with levels of hierarchy (that is, a graph node can be a graph itself — think of it as an electronic circuit where a gate can actually be an integrated chip, for instance). Thus, I have…

tobast
- 101
- 4
0
votes
3 answers
Easier way to write encapsulated parent/child data structure?
From time to time I find myself often writing a data structure of "parents" and "children", where:
A parent has references to 0 to N distinct children.
A child has a reference to 0 parents or 1 parent.
The reference must be mutual. For any given…

Hatchling
- 191
- 1
- 7
0
votes
1 answer
What's the sense of the __get() & __set() methods
Today I read a Tutorial about MVC, the guy was using magic-methods (__get & __set()) to access a private member value. (LINK)
First I was confused what __get and __set do, but after reading trought the Internet I finally found out, that this methods…

Petschko
- 168
- 3
- 16
0
votes
2 answers
Class member variable and method name collision
I am working with a 3rd party library where I'm trying to access a class member variable but unfortunately there is also a method with the same name.
class Test
attr_writer :var
def var
"some other stuff that is not var"
end
end
test =…

Vincent
- 2,342
- 1
- 17
- 22
0
votes
2 answers
C++ operator ->* and .*
Good day,
I've come across this question, but I'm specifically interested in the "object pointed to by member ..." type operators as listed here on Wikipedia.
I have never seen this in the context of actual code, so the concept appears somewhat…

namezero
- 2,203
- 3
- 24
- 37
0
votes
0 answers
How we access inner class's non static members in its outer class?
public class Student {
int rollNumber;
String name;
int noOfSubjects;
ArrayList subjectList = new ArrayList<>();
public TestStudent(int rollNumber, String name, int noOfSubjects) {
super();
…

Alok Mishra
- 926
- 13
- 39
0
votes
1 answer
C Union and simultaneous assignment to members
In the following code
#include
int main()
{
union myUnion
{
int intVar;
char charVar;
float floatVar;
};
union myUnion localVar;
localVar.intVar = 10;
localVar.charVar = 'A';
…

Sagrian
- 1,048
- 2
- 11
- 29
0
votes
2 answers
Issues accessing a struct array when it is sent into a function
I am a new C programmer and so you will have to excuse my lack of knowledge. Slowly but surely I am improving. I am wondering why I am unable to access the members of my structure after I have sent them to a function that intends to modify them.…

TheCount
- 25
- 5
0
votes
1 answer
Member access through pointer to object
On the stack the compiler is free to do a lot of optimizations, because the context is static and known at compile time, but when dealing with access to dynamically allocated objects and generally accessing "by reference" the context is not known,…
user2341104
0
votes
1 answer
Umbraco Members Area Accessed Via Browser Back Button
I have two website which have Members areas. We have set up the members, member groups and member types, then created content documents, right-clicked and set the public access permissions to the top level node of the members area.
This all works…

Kerry Lindsay
- 1
- 1
0
votes
1 answer
Outputting member variables when data is spliced c++
Hello I currently face a problem were I want to output data from 2 separate classes, one is a base class and one is a derived class, I want to overload the << operator to output all the data at once but seem to have trouble doing so, I have…

user1314272
- 141
- 1
- 13
-1
votes
2 answers
Accessing elements of std::vector>grid gives error "Expression must have a class type"
I've searched far and wide and can't find an answer. Why can't I access the elements? It gives me the error: "Expression must have a class type". I have no idea what this means. Can someone give me a solution to this please?
#include…

George Austin Bradley
- 330
- 1
- 6
-1
votes
1 answer
C: How do I correctly access an Array element of a Struct passed by reference?
I have this code:
typedef struct _structVar{
int myArray[10];
} structVar;
structVar MyStruct;
Then I'm passing the struct by reference to a function:
myFunct(&MyStruct);
How I access array elements inside MyFunct?
void myFunct(structVar…

Eventine
- 33
- 4
-2
votes
1 answer
Problems printing out a string
This is my code:
typedef struct person
{
char firstName[40];
char lastName[40];
char id[40];
} Person;
struct personDataBase
{
Person personList[100];
int numOfPersons;
} personDataBase;
Person createPerson()
{
Person p;
…
-2
votes
1 answer
Some questions about functions with a class type
So I am using C++ and experimenting with classes. I am trying to create a function with a class type. Here is the code:
struct action{
void setup(std::string){
/*...*/
}
};
action move(){
setup("*");//<-error:[use of undeclared identifier…

Eden Cheung
- 303
- 2
- 8