I have Python classes, of which I need only one instance at runtime, so it would be sufficient to have the attributes only once per class and not per instance. If there would be more than one instance (what won't happen), all instance should have the same configuration. I wonder which of the following options would be better or more "idi...
I have a templated class Matrix. I want to specialize a function for the type complex, where T can be anything. I have tried this :
6 template <typename T>
7 class Matrix {
8 public :
9 static void f();
10 };
11 template<typename T> void Matrix<T>::f() { cout << "generic" << endl; }
12 template<> v...
If I have a class like this:
class A {
public string fe = "A";
}
And a class that inherits from it like so:
class B : A {
public string fe = "B";
}
Visual C# will tell me that B.fe hides A.fe so I should use the new keyword. So I change class B to look like:
class B : A {
public new string fe = "B";
}
And then I have...
Why is t.b evaluated on every call? And is there any way how to make it evaluate only once?
type test =
{ a: float }
member x.b =
printfn "oh no"
x.a * 2.
let t = { a = 1. }
t.b
t.b
...
I have a class instance, and I want to enumerate its members.
How can this be done?
...
In the following Lisp REPL interaction:
CL-USER> (defparameter *unison* 0)
*UNISON*
CL-USER> (member *unison* '(*unison*))
NIL
why is nil returned?
...
I get the above error when calling this code:
<?
class Test1 extends Core {
function home(){
?>
This is the INDEX of test1
<?
}
function test2(){
echo $this->uri->get_segment(1); //this is where the error comes from
?>
This is the test2 of test1 testing URI
<?
}
}
?>
I get the error where commentated.
This class extends this class:
...
#include <iostream>
typedef struct _person
{
std::string name;
unsigned int age;
}Person;
int main()
{
Person *pMe = new Person;
pMe->age = 10;
pMe->name = "Larson";
std::cout << "Me " << (*pMe).age << " " << (*pMe).name.c_str() << std::endl;
return 0;
}
Consider the above code. The members of the struct...
class A
{
public int a;
public int c;
}
i will create 10 instances from A.Then i will create 15 instances from A again... go on. first 10 instance will have same value for a variable and next 15 instances will have again same value for a.But I don't mean that both group has same values for a .Problem is create same a value 10 times i...
Let's assume I have a class ClassWithMember
class ClassWithMember
{
int myIntMember = 10;
}
How do I get the default value 10 of the myIntMember member by System.Type?
I'm currently struggling around with reflections by all I retreive is the default value of int (0) not the classes default member (10)..
...
How do I access a static member in a class with all static methods?
I want to have a group of related functions but also have some important data members initialized before any of these functions are called. I thought a class with only static members would be the way to go. Compiler in VS2008 doesn't like me trying to access "a".
Sure...
Does anybody have an examples of this, from what I've read umbraco kicks up a bit of a stink but I can't find any examples
...
I know it's possible to separate to create a pointer to member function like this
struct K { void func() {} };
typedef void FuncType();
typedef FuncType K::* MemFuncType;
MemFuncType pF = &K::func;
Is there similar way to construct a pointer to a const function? I've tried adding const in various places with no success. I've played ...
I am reading a book called 'Effective C++, Second Edition' and its talking about const member functions and how you have bitwise const-ness and conceptual const-ness.
It says most compilers will go with bitwise const-ness, which is that you cannot alter data members of an object inside a const member function.
Then there's an example o...
Code snippet to follow.
I have a struct (example code has class, tried both, same effect) that will store a number of char *. I made a constructor for the class that initializes most of them to = "";
Upon attempting to modify that member of an instance of the class, strncpy et all report access denied. These functions even report acce...
I want to provide a member function for the "comp" parameter of an STL algorithm like lower_bound( ..., Compare comp ). The comp() function accesses a non-static member field so it must itself be a non-static member but the type of a non-static member function pointer is different from that of an ordinary function pointer.
What is the ...
must class member initialization lists in c++ be complete? or can they simply initialize one or two of the member data in a class?
thanks in advance!
...
I'm coming from a C++ background to python
I have been declaring member variables and setting them in a C++esqe way like so:
class MyClass:
my_member = []
def __init__(self,arg_my_member):
self.my_member = arg_my_member
Then I noticed in some open source code, that the initial declaration my_member = [] was completel...
If you're using Xcode, you may know member listing menu of Objective-C.
http://www.flickr.com/photos/47601728@N06/4832964826/
Xcode lists members of javascript too, but marking lines by #pragma - is now allowed in javascript. Is there any way to do this?
...
I saw that this was used in sample code to accept all the warnings (like certificate warnings) when trying to connect to a repository but I wasn't sure exactly what the Save=true; was specifically doing whether it was saving the fact that these certificates were accepted ect. Any insight would be appreciated. Thanks.
...