Questions tagged [members]

175 questions
1
vote
9 answers

Is it better to store class constants in data members or in methods?

I recently wrote a class that renders B-spline curves. These curves are defined by a number of control points. Originally, I had intended to use eight control points, so I added a constant to the class, like so: class Curve { public: static…
fluffels
  • 4,051
  • 7
  • 35
  • 53
1
vote
0 answers

VC2010 Change Auto List Members

Anyone know how to change the Auto List Member highlight from yellow to whatever? I'm currently using the VC2010 C++ edition. Its difficult to see the highlight vs my other font colors. Thanks :D
Saith
  • 11
  • 1
1
vote
0 answers

Pointer to member function with move semantics

I've just came upon a strange construct: void (std::thread::*&&)() I know it is a sort of a pointer to a class member function. But how to interpret the '&&' operand? What is the meaning of this?
def
  • 521
  • 4
  • 16
1
vote
2 answers

How to dynamically add members to class

My question can be simply illustrated by this code: def proceed(self, *args): myname = ??? func = getattr(otherobj, myname) result = func(*args) # result = ... process result .. return result class dispatch(object): def…
Willy aTan
  • 13
  • 3
1
vote
1 answer

Check some members are not null

I have a class with about 20 members and I have a method to validate that 10 specific members are not null. At first I thought none of them could be null so I was doing a for loop through this.getClass().getDeclaredFields() but when I learned that…
coconut
  • 1,074
  • 4
  • 12
  • 30
1
vote
7 answers

C++ class members

I came from Java to C++ ... When I try to do this ... class Box { Table* onTable; }; class Table { Box* boxOnIt; }; int main() { Table table; Box box; table.boxOnIt = &box; box.onTable = &table; return 0; } the…
Mustafa
  • 931
  • 1
  • 13
  • 26
1
vote
1 answer

Struct sorting with different members

I'm trying to do a project... The project needs to read from a csv file that have contacts. The contacts have several fields that I read to an array of structs of type contact. Ex: array.contactFirstName, array contactLastName, etc. Here is some…
1
vote
1 answer

MDX - Concatenate level's properties and level's members

I an using mondrian and I have this issue: using a query mdx I need to concatenate in each member name belonging to a certain level, its name and a the value of a certain level properties for that member. Something like CurrentMember.Name =…
user527820
  • 11
  • 2
1
vote
1 answer

C++ Keep tracks of changes inside a class

Imagine a class representing a mail : class mail { string subject; string content; date receivedDate; }; Now what I want to achieve is to know if my mail data is set, and once they're set, which ones where changed. I could go with a…
Louka
  • 152
  • 10
1
vote
1 answer

Wordpress: Capabilities Custom Post type delete_post is not working

I'm using Custom Post Type and "Members" plugin in wordpress. My problem is that in my custom post type I can't delete posts, the link to move to trash is not there :( Here is my code: 'capabilities' => array( 'edit_post' =>…
curosio
  • 78
  • 10
1
vote
4 answers

Disallow fields in descended class C++

With a friend, we had following problem recently. There was a base class: class A { public: A() : foo(10) {} virtual int getFoo() const { return foo; } protected: int foo; }; A friend implemented a class deriving from the one…
GiM
  • 460
  • 4
  • 13
1
vote
1 answer

C++ Set values for members of a struct**

I've defined in my foo.h the following variables #define APILONG long #define APIDOUBLE double #define APISTRING const char* And also the following struct struct SetupData { APISTRING customerName; …
David A.
  • 83
  • 1
  • 15
1
vote
3 answers

Get the sizeof Object's Members

There is an object who's members I need to find the size of. I am specifically asking for the object's size without it's v-table considered. Also, I cannot modify it, so I cannot take advantage of this answer. Is there a provision for this in C++,…
Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
1
vote
3 answers

this->member VS member in C++

what is the difference between this: int MyClass::getId() { return this->id; } and this: int MyClass::getId() { return id; } in C++?
Accumulator
  • 873
  • 1
  • 13
  • 34
1
vote
2 answers

Template object as static member of the template class

Imagine the following template class (setter and getter for the member _t omitted): template class chain { public: static chain NONE; chain() : _next(&NONE) {} ~chain() {} chain& getNext() const { return *_next; …
Mephane
  • 1,984
  • 11
  • 18