I have a class CContainer that has some members CMemberX, CMemberY, which are independent of each other and other CClientA, CClientB classes that use CContainer.
#include "MemberX.h"
#include "MemberY.h"
class CContainer
{
public:
CMemberX & GetX() const { return m_x; }
CMemberY & GetY() const { return m_y; }
private:
CMem...
I'm trying to write a function that will return a reference to a PDO object. The reason for wanting a reference is if, for some reason, the PDO object gets called twice in one page load, it will just return the same object rather than initializing a new one. This isn't silly, is it? :/
function &getPDO()
{
var $pdo;
if (!$pdo)
...
HI,
My job was to create a webservice which acted as another webservice we have, so the client doesn't notice the difference. I created my entire webservice and it works fine as I use it and the outputs all are the same. The thing is, I created a clientapplication where I use the old webservice and if I change the url of the webreferenc...
Hello !
I have a Dwoo template - in example base.html and there is an array $data.
{assign '' 'globalVar'} {* $globalVar empty right now *}
{foreach $data element}
{include '_partial.html'}
{/foreach}
...
<b>{$globalVar}</b>
And here is _partial.html
<p>
{$element.someText}
</p>
{assign "$globalVar $element.someVar" 'gl...
I am using Eclipse Ganymede.
I have a project open and call a static method of a class in another project, which the current one references.
I close the current project, open the referenced library's project, change the method return type, and rebuild its jar. (It's set to build automatically, but I tried explicitly rebuilding all any...
I have a .NET console app that references a DLL. It runs fine if the DLL is in the same folder as the EXE but I would like to put the DLL in a different folder. How can I do that?
...
Hi I was wondering what the most effective way of accomplishing the below would be. ( i know they accomplish the same thing but was wondering how most people would do this between the three, and WHY )
a.pl
my %hash = build_hash();
# do stuff with hash using $hash{$key}
sub build_hash
{ # build some hash
my %hash = ();
my @...
I have a simple 'dimensions' class containing a width/height property and a constructor to set them.
I have a function (to re-size dimensions) that takes two dimensions objects -- one to be re-sized, and one containing the max size. It should reduce the dimensions in the first parameter such that they 'fit into' the second parameter.
T...
I'm currently working on a project I've just received that is asp.net + vb.
I have to add a gridview in one part of the page, but it simply won't let me set the datasource
<%@ Page Language="VB" MasterPageFile="~/Common/Common.master" title=whatever" %>
<%@ Register TagPrefix="uct" TagName="SubmenuControl" Src="whatever.ascx" %>
this ...
In an MVC 1.0 C# app, what's the different between the following:
HttpContext.Current.Session["MyValue"] = "ItsValue";
and
Session["MyValue"] = "ItsValue";
...
Hi,
Somewhere on my code I need to create several windows from a main window, each functioning with a specific configuration but all instances of the same controller object.
I also need to keep a list of open windows, so whenever I open a window I store its instance in a dictionary and when the window is closed I send a notification to...
Hi,
How to translate properly the following Java code to C++?
Vector v;
v = getLargeVector();
...
Vector getLargeVector() {
Vector v2 = new Vector();
// fill v2
return v2;
}
So here v is a reference. The function creates a new Vector object and returns a reference to it. Nice and clean.
However, let's see the following C...
I recently saw the below code ( simplified version given below) in my code base and got this doubt:
class B;
class A
{
public:
A():m_A("testA"){}
B& getB()
{
return m_B;
}
B* getBPtr() //== > written to explain the problem clearly
{
return &m_B;
}
private:
B m_B;
};
class B
{
pub...
hi!
foo1(int* val){(*val)++;}
foo2(int &val){val++;}
will the compiler create in both cases the same code? will it simply write a pointer into the parameterpart of foo's stackframe? or will in the second case the callers' and foos' stackframes somehow overlap such that the callers' local variable takes the same memory on the stack as...
Hi,
I am creating a project that requires the System.ServiceModel.Web.dll. I have added a reference by right-clicking the reference "folder" in the project explorer. A search of the system shows System.ServiceModel.Web.dll in different directories: Program Files(x86), x64, GAC, etc. It doesn't seem to matter which one I pick, as I al...
When an array is passed as an argument to a method or function is it passed by reference?
What about doing this:
$a = $array(1,2,3);
$b = $a
Is $b a reference to $a?
...
Ok, this is a weird problem, so please bear with me as I explain.
We upgraded our dev servers from PHP 5.2.5 to 5.3.1.
Loading up our code after the switch, we start getting errors like:
Warning: Parameter 2 to mysqli_stmt::bind_param() expected to be a reference, value given in /home/spot/trunk/system/core/Database.class.php on line ...
e.g. something like ( ref this ) which does not work ... E.g. this fails:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CopyOfThis
{
class Program
{
static void Main(string[] args)
{
View objView = new View();
objView.Boo();
o...
Hi
I'm a php developer looking to learn jquery, with no Javascript experience.
Ideally, I would like a beginners self teaching guide in a book, that I can use as a reference.
Any suggestions?
...
Possible Duplicate:
Passing pointer argument by reference under C?
Are reference variables a C++ concept? Are they available in C? If available in C, why is my code giving a compilation error?
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a = 10;
int b = 20;
int &c = a;
int &d = b;
return 0;
}
Output:
ba...