I am unable to understand the logic behind List<int> as it breaks some of the basic rules.
List<int> is supposed to be of value type and not reference type.
List<int> has to be passed by ref keyword if its value has to be persisted between function calls. So this means it is displaying a value type behavior similar to int.
But List...
I have a class InventoryScreen that has a reference to another class GameData as a member, like this:
class InventoryScreen {
private:
GameData& gameData;
public:
InventoryScreen(GameData& gd): gameData(gd) {}
(...)
};
class GameData {
private:
std::vector<Item> items;
(...)
};
In a member...
I'm working on a VS solution with 100+ projects in C#. I'm currently migrating it from VS 2008 to VS 2010. There is some work to be done because a lot of the projects use Enterprise Library 4 (which has to be upgraded to 5.0) and WCSF 2008 (which has to be upgraded to SCSF 2010). I'm going through the SCSF upgrade instructions, and one i...
I'm trying to understand if there is any benefit to returning a const reference. I have a factorial function that normally looks like this:
unsigned long factorial(unsigned long n)
{
return (n == 0) ? 1 : n * factorial(n - 1);
}
I'm assuming that there will be a performance increase when we pass by const reference and we return a ...
For some types in Python, the is operator seems to be equivalent to the == operator. For example:
>>> 1 is 1
True
>>> "a spoon" is "a spoon"
True
>>> (1 == 1) is (2 == 2)
True
However, this is not always the case:
>>> [] == []
True
>>> [] is []
False
This makes sense for immutable types such as lists. However, immutable types suc...
It could be a useful resource - website-reference, listing all the OpenID providers along with the features they support - SREG and/or AX, PAPE policies, etc.
Are there any?
...
This is a question from an exam in an advanced course in OOP, taught in C++ (in TAU university, this semester):
Q: What is the difference between a C++ pointer and a reference?
A. A reference is the entire object while a pointer is only the address of it.
B. The same meaning, and difference is only in syntax and usage.
C. The sy...
To make my own assemblies appear in the .NET tab's list of Add Reference dialog, I added HKLM\SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\MyAssemblies registry key. Then I changed default string value to "C:\Common\". Exactly like Microsoft How-to recommends. However, I fail to see my assemblies that located in C:\Common folder i...
It's getting a little weird I can't see a method to actually change the "data" of a QStandardItemModel. For example:
struct TestStruct {
std::vector<int> testVector;
void addNumber(int i){
//this method will modify the member vector
}
};
Q_DECLARE_METATYPE(TestStruct)
QStandardItemModel* model = QStandardItemModel...
In the big picture I want to create a frame based application in Bada that has a single UI control - a label. So far so good, but I want it to display a number of my choosing and decrement it repeatedly every X seconds. The threading is fine (I think), but I can't pass the label pointer as a class variable.
//MyTask.h
//...
result Con...
Is this the correct syntax for passing a file pointer by reference?
Function call: printNew(&fpt);
printNew(FILE **fpt)
{
//change to fpt in here kept after function exits?
}
Thanks.
...
Hi there,
I need to reference a service that is a part of another project.
I have declared and implemented the contract of the service and then tried to
add a standard reference (right click ->Add Service reference, and added
http://localhost:8000/MyService?wsdl
The proxy has been generated and it should work at the first glance, how...
I'm getting a really weird FileNotFoundException thrown the first time I try to use a class defined in an assembly I have referenced. The assembly hasn't changed, and the location in the project file corresponds correctly to the physical path on disk.
This suddenly started failing in a solution that consists of two library projects, a w...
Hi,
I have one usercontrol which contain one textbox, few buttons and one calander.
I had place two instance of user control in one page as design time. It works fine all working from server side...mean server side events reference proper control at runtime.
Problem start after raising server side events from javascript. I succeed to f...
I'm making a LaTeX PDF document and using the hyperref package and \ref to make references to section & subsections later in the document. Some of my (sub)section references have an underscore (_) in them, so I have escaped them (i.e. put in \_), however when I run pdflatex on it I get the following error:
! Missing \endcsname inserted....
I have been using the hyperref package and \hyperref[…]{…} to put a clickable link (in a PDF) to a section or subsection. However I want to put the clickable link before i put the \subsection declaration. My first attempt seems to produce a link that goes to the first page. Is there something special you have to do to get the links worki...
I need UrlEncode in my application because i am submitting a form to my server. My app is a quick console utility targeting to .NET 3.5.
The page says i need System.Web assembly, yet when i try to add the reference it isnt there. My WebServer application has it which is also targeted to 3.5 but this console app cant reference it. Why no...
I want to iterate through a reference to an array of hashes without having to make local copies, but I keep getting Can't use string ("1") as an ARRAY ref while "strict refs" errors. Why? How do I fix it?
sub hasGoodCar {
my @garage = (
{
model => "BMW",
year => 1999
...
Has anyone done this?
I have created an assembly and installed it to the GAC. It's listed in gacutil and I can see it in c:\windows\microsoft.net\assembly folder.
I have found people saying to add registry keys, but the folders they specify don't exist, and when I create them, my assembly is still not appearing in the list.
I have tr...
I'm creating a game, and am currently working on the Inventory system for it. I have a class to represent the player, which looks like this:
class Player {
public Weapon WeaponSlot {get;set;}
public Shield ShieldSlot {get;set;}
//etc.
}
Weapon, Shield, etc are subclasses of a generic Item class:
class Item {
//...
}
...