Questions tagged [members]

175 questions
159
votes
6 answers

Unresolved external symbol on static class members

Very simply put: I have a class that consists mostly of static public members, so I can group similar functions together that still have to be called from other classes/functions. Anyway, I have defined two static unsigned char variables in my class…
Daniel
17
votes
9 answers

Testing private class member in C++ without friend

Today I had a discussion with a colleague on whether to test or not to test private members or private state in the class. He almost convinced me why it makes sense. This question does not aim to duplicate already existing StackOverflow questions…
ovanes
  • 5,483
  • 2
  • 34
  • 60
16
votes
2 answers

Is there any difference regarding performance of private, protected, public and internal methods in C# classes?

Is there any difference regarding performance of private, protected, public and internal methods in C# class? I'm interested if one consumes more processor time or RAM.
Vadim
  • 1,223
  • 2
  • 17
  • 26
12
votes
7 answers

Do Sub-Classes Really Inherit Private Member Variables?

Basically as far as I know, when you create a base class with a public, protected, and private section and variables/functions in each the public and protected sections will get inherited into the appropriate section of the sub-class (defined by…
TorbenC
  • 153
  • 1
  • 2
  • 9
12
votes
1 answer

How to synchronize access to private members of a javascript object

I have a Javascript object created as follows: var ccStatTracker = (function (){ ccmap:{ "1":["1","2","3","4"], "2":["4","5"]; } return { modifyCCMap: function (){ // Code which takes following actions: // -…
Shailesh Vaishampayan
  • 1,766
  • 5
  • 24
  • 52
11
votes
1 answer

How do you iterate over all methods in a JavaScript pseudoclass, regardless of whether or not they are marked enumerable?

I'm trying to iterate over all methods in a JavaScript pseudoclass and can easily tell if something is a method or not with (obj.member instanceof Function), however I'm trying to include methods that may be hidden from a for...in loop via…
CoryG
  • 2,429
  • 3
  • 25
  • 60
11
votes
1 answer

Union tested for current member in use

Do unions have a control structure to test which member is currently in use (or if it has any at all)? I'm asking this because undefined behavior is never a good thing to have in your program.
Alex D.
  • 427
  • 1
  • 5
  • 14
10
votes
2 answers

To use getAttribute(), or not to use getAttribute(): that is the question

Possible Duplicate: JavaScript setAttribute vs .attribute= javascript dom, how to handle "special properties" as versus attributes? Many times, in forums or places such as Usenet I have been told by some (when criticizing my code) that instead of…
user912695
10
votes
3 answers

Is it possible a class to inherit only some(not all) base class members?

Is there a way that a derived class could inherit only a few of all the base class members..in C#? If such maneuver is possible, please provide some example code.
CSharp4eto
  • 147
  • 2
  • 6
10
votes
5 answers

The size of a Get method

Are there any guidelines or general consensus towards the size of a 'Get' in terms of lines of code? I have a Get method on a member that has quite easily grown to 30 lines of code here. I'm not sure at what point this should be pulled out into a…
user1017882
8
votes
5 answers

Get method of a class in the order that it was in the code

This code: import inspect class Obj(): def c(self): return 1 def b(self): return 2 def a(self): return 3 o = Obj() for name, value in inspect.getmembers(o, inspect.ismethod): print str(value())+"…
santos82h
  • 452
  • 5
  • 15
7
votes
3 answers

Non static const data members

How do I define a non-static const data member of a class in C++? If I try compiling the following code: class a { public: void print() { cout<
Atishay
  • 1,026
  • 3
  • 11
  • 20
7
votes
3 answers

Javascript new object (function ) vs inline invocation

Is there any considerations to determine which is better practice for creating an object with private members? var object = new function () { var private = "private variable"; return { method : function () { ..dosomething…
Sheldon Ross
  • 5,364
  • 7
  • 31
  • 37
7
votes
3 answers

What does convert to auto-property mean?

Apologies if this has been asked before but I'm new to programming. Question: Whenever I create properties, I get a message stating I should convert it to an auto-property. My program runs so should I be worried about this? using System; namespace…
user3554072
  • 287
  • 8
  • 21
5
votes
4 answers

What does it mean to be a private member (c++ classes)?

I am a little confused about private data members in C++ classes. I am new to coding and still in the middle of my 'Classes' chapter so I might be ahead of myself, but I feel like I am missing a piece of information: Let's say I have this…
Luc Aux
  • 149
  • 10
1
2 3
11 12