Very simply put:
I have a class that consists mostly out 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 chars in my class' public scope, when I try to modify these values in the same class' constructor, I am gettin...
in a c++ class declaration, you can label a group of members as private or public, e.g.
private:
int x;
double y;
seems like there's no way to do this in c#. am I wrong?
...
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 const int CONTROL_POINT_COUNT = 8;
};
Now I want to extend this class to allow an arbi...
I have a Message class which parses text messages using lookup tables. I receive a lot of messages and create and destroy a lot of objects so I thought I declare those lookup tables as static members to prevent initializing the same tables with the same values again and again.
Is it the correct approach or there's more appropriate C++ w...
I want to create a table of friends with personal information and log on details.
What better to separate the members table to 2 tables ,
one contain minimal details ,
second with Other details.
or remain in one table ?
i have a lot of tables that contain the foreign key of the member.
...
Can an object of ifstream type used for file reading be a static member of a class? I want to read a file and store each line in an array of objects of a class i have created. I want the file reading object to belong to the entire array of objects instead of one single instance of the class.
...
i was asked the above question during one of my interviews.
Although i answered that i will talk with each of the employees individually and try to make comfortable in the current position but still i think there may be a better answer for this question.
The scenario is as follows:
suppose i have 5 members in my team and my org is la...
Hey Guys
Is it possible to access to access and use static members within a class without first creating a instance of that class? Ie treat the the class as some sort of dumping ground for globals
James
...
Hi,
My previous question about this subject was answered and I got some tests working nice.
http://stackoverflow.com/questions/1786809/c-map-functions-of-a-class
My question is now, if there is a way to while declaring the function, be able to register it in a map, like I realized in this question about namespaces and classes:
http://s...
I observed that Outer classes can access inner classes private instance variables. How is this possible? A sample code demonstrating the same is explained below::
class ABC{
class XYZ{
private int x=10;
}
public static void main(String... args){
ABC.XYZ xx = new ABC().new XYZ();
System.out.println("H...
I have instances of class A and B, and both classes implement a member 'Text'. Is there a way to access member Text in a generic way?
I'm hoping for something analogous to the javascript way of simply saying:
instance['Text'] = value;
Note: these two classes unfortunately do not both implement the same interface with a Text member.
...
Hard to capture the problem in a single sentence, but the problem is a simple one. Table looks like this:
col_a col_b
v1 c
v2 c
v3 c
v5 d
v2 d
v1 a
v5 a
v7 a
v4 a
Each row is distinct, and I need a count of the rows for each unique value of col_b. So, my resu...
Hi, in the below example, what would happen?
class Base {
public int abc = 3;
}
Class Derived : Base {
public int abc = 2;
}
static void Main() {
Derived blah = new Derived();
Console.WriteLine(blah.abc);
}
I'm sure you would see '2' on your console, but what I'm reading (and seeing) opposes that...
Why would you see...
I have a simple object that holds some [public] data.
I want to keep my interface clean, so I don't want to pre-/post- fix anything to the names of the publically accessible variables nor to the names of my function arguments.
That said, I ended up doing something like this:
template<typename T> struct Foo
{
explicit Foo(T x) : x(x)...
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 with private;
}
}
}
VS
var object = function () {
...
}();
Basically what ...
Okay. Now I give up. I have been playing with this for hours.
I have a variable name $data.
The variable contains these contents: (extracted by using var_export())
array (
'headers' =>
array (
'content-type' => 'multipart/alternative; boundary="_689e1a7d-7a0a-442a-bd6c-a1fb1dc2993e_"',
),
'ctype_parameters' =>
array (
...
Imagine the following template class (setter and getter for the member _t omitted):
template<class T>
class chain
{
public:
static chain<T> NONE;
chain()
: _next(&NONE)
{}
~chain() {}
chain<T>& getNext() const
{
return *_next;
}
void setNext(chain<T>* next)
{
if(next && next != this)
_next = next;
...
Hello StackOverflowers,
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 above.
class B : public A {
public:
void process() { foo = 666; }
p...
Hello!
I have the following code:
void Foo() {
static std::vector<int>(3);
// Vector object is constructed every function call
// The destructor of the static vector is invoked at
// this point (the debugger shows so)
// <-------------------
int a;
}
Then somewhere I call Foo several times in a sequence
Why doe...
Does anyone know which WMI Class is to be used to getting information of which users or user groups have permission for a given folder?
...