Say I have:
class A
{
A()
{}
~A()
{}
};
class B
{
public:
B()
{}
~B()
{}
private:
static A mA;
};
B* pB = new B;
delete pB;
When I call delete pB, B's destructor will be called. Will this then call the destructor for static member A?
...
Hi, I'm having some toubt here. Hope you guys can share out some programming tips. Just curious to know whether is it a good programming practice if I do something like the code below.
class Outer {
public:
class Inner {
public:
Inner() {}
}
Outer() {}
};
I have been doing this for structure where I only want my str...
Dear all,
I used to use OpenC++ (http://opencxx.sourceforge.net/opencxx/html/overview.html) to perform code generation like:
Source:
class MyKeyword A {
public:
void myMethod(inarg double x, inarg const std::vector<int>& y, outarg double& z);
};
Generated:
class A {
public:
void myMethod(const string& x, double& y);
...
Can C++ std::stack handle more than 10k int items? And how about its performance?
...
I am trying to make a recursive program that calculates interest per year.It prompts the user for the startup amount (1000), the interest rate (10%)and number of years(1).(in brackets are samples)
Manually I realised that the interest comes from the formula YT(1 + R)----- interest for the first year which is 1100.
2nd year YT(1 + R/2 +...
Hello,
I've written a C++ library that reads in this 3d model file (collada DAE). uptil now, I would output a list of triangles and handle each of them at rendering stage.
But now, I need to attach some Bounding sphere information with the imported model. I need some advice on how should I organize this in code. Here are some specs of...
So in C++ There's a lot of times where you need to make an "index" class. For example:
class GameID{
public:
string name;
int regionid;
int gameid;
bool operator<(const GameID& rhs) const;
}
Now, if we were to represent GameID as pair<string, pair<int, int> >, the operator comparison just comes with it. Is t...
Hi folks,
My C++ knowledge is somewhat piecemeal. I was reworking some code at work. I changed a function to return a reference to a type. Inside, I look up an object based on an identifier passed in, then return a reference to the object if found. Of course I ran into the issue of what to return if I don't find the object, and in looki...
Hi,
I have added some const character in my file as under. The error i get is duplicate symbol _xyz(say). What is the problem with it and how could i get out of this.
const char* xyz = "xyz";
class Abc
{
public:
Abc()
{
}
};
...
Hello. I have interface in ATL project which must contains member with parameter of Scripting::IDictionary** but in MIDL file with description of my interface it's not possible because Scripting library is not presented in default library. I always have scrrun.tlb and trying to use it in MIDL but it's not work
Code is here: midl-code
...
To define constants, what is the more common and correct way? What is the cost, in terms of compilation, linking, etc., of defining constants with #define? It is another way less expensive?
...
Hi
im using QTimeLine to run animation , now i like to trigger my custom function when the finished() signal is triggered
when the QTimeLinedo done its just ,but whit no lock i never getting this signal to fire
even that my :
QTimeLine::State sts = timeLineFadeIn->state(); is QTimeLine::NotRunning
Any idea why ?
...
Hi,
In my project I am using QGraphicsView/QGraphicsScene stuff.
On my scene there will be regions that contains 2D graphics.
Region count will be limited(Lets say 20)
Users can choose to display one or more regions.
If user choose to display one region I am going to show one region on scene
If user choose to display n regions I am goin...
I want to list all numbers from 0000-9999 however I am having trouble holding the zero places.
I tried:
for(int i = 0; i <= 9999; ++i)
{
cout << i << "\n";
}
but I get: 1,2,3,4..ect
How can I make it 0001,0002,0003....0010, etc
...
I am creating an interpreter for my esolang, and I need the user to enter some text which then will be interpreted as an INTERCAL program. I want the user to enter text, which may contain any character including newlines, until the user presses ^X (Ctrl-X), like this:
Enter your code followed by ^X:
Bla
Blablabla
Bla^X
Thank you for ent...
The title says it all really. If I am accessing a single integer type (e.g. long, int, bool, etc...) in multiple threads, do I need to use a synchronisation mechanism such as a mutex to lock them. My understanding is that as atomic types, I don't need to lock access to a single thread, but I see a lot of code out there that does use lo...
Hi All
How to use the following interface in wince 6.0 r3 for implementing hardware acceleration for graphics in silverlight
IRenderer
ICustomSurface
ICustomGraphicsDevice
Thanks in Advance
...
Hi,
I have a program which writes its output using ofstream. Everything works perfectly fine on Windows when compiled with Visual Studio, but it only writes empty file on Linux when compiled with GCC.
ofstream out(path_out_cstr, ofstream::out);
if(out.bad()){
cout << "Could not write the file" << flush;
}
else{
cout << "writing";
ou...
Is it possible to open and fstream on a file that does not exist with both ios::in & ios::out with out getting error?
Thanks in advance.
...
I have a very simple C++ code here:
char *s = new char[100];
strcpy(s, "HELLO");
delete [] s;
int n = strlen(s);
If I run this code from Visual C++ 2008 by pressing F5 (Start Debugging,) this always result in crash (Access Violation.) However, starting this executable outside the IDE, or using the IDE's Ctrl+F5 (Start without Debuggin...