Hi, everyone!
I have a class that encapsulates some arithmetic, let's say fixed point calculations. I like the idea of overloading arithmetic operators, so I write the following:
class CFixed
{
CFixed( int );
CFixed( float );
};
CFixed operator* ( const CFixed& a, const CFixed& b )
{ ... }
It all works. I can write 3 * CFixe...
I have a class that can be decorated with a set of add-on templates to provide additional functionality. Each add-on has an identifying addon_value that the base class needs to know.
The code below is an example of what I would like to do. Obviously, the main() function fails to compile. The goal is for CBase::GetValueOfAddOns() to kno...
Hi
I just don't seem to be able to figure this out in my head. I'm trying to move an object in 3D space.
If I have a point at 5,15,5 and use opengl functions to change the model view....
glTranslatef( 10.0f, 4.0f, 4.0f );
glRotatef( 33.0f, 1.0f, 0.0f, 0.0f );
glTranslatef( 10.0f, 4.0f, 4.0f );
Is there a way I can find out where tha...
C++ has too many features, and I can't see how any programmer is able to remember all these features while programming. (We can see how this affected the design of newer languages, such as Java)
So, what I need is a list of features that are enough to know, disregarding all the others, to create c++ programs, perhaps created by someone ...
Suppose I have a solution with 3 projects X,Y, and E.
E will generate an executable and X and Y will generate static libraries such that Y includes the header files of X and E includes the header files of Y.
Now, my question is: why do I have to include the directory of the header files of X in E?
...
There is a scenario where an application tells a device on a network to get their IP address from the network router's DHCP server. If a DHCP server is not available, the device's behavior becomes erratic. Is there a method to procedurally detect if the network router supports DHCP? Or, is this something the device needs to do when at...
Are there any tools (for C/C++) available to visualize the modules affected or the test cases to be executed when a block of code in changed.
Example,
If i modify few lines in a method of a class,
I should be able to get metrics on number of calling methods, affected modules.
Also If i have a traceability from Code-TestCase, can this...
Hi,
I'm trying to use the khtml library, basically just the DOM html implementation from there, but I even failed to create a basic HTMLDocument from a file using load(), and when I tried to create a HTMLDOcument by mutating it via appendChild I get DOMException with errorcode == 8 (NOT FOUND).
Can anyone please point me to some sampl...
Try to see which cast is faster (not necessary better): new c++ case or old fashion C style cast. Any ideas?
...
I have a class that can be decorated with a set of add-on templates to provide additional functionality. Each add-on needs to be able to call the base class and the user needs to be able to call the base class (either directly or using the CMyClass as a proxy).
Unfortunately, the compiler can't tell which base class I'm calling and I ge...
For some reason, this very basic code will compile with no errors in Visual C++, but gives errors in XCode. I will need to know why, in order to continue working in Xcode for my Computer Science class.
#include <iostream>
#include <string>
using namespace std;
struct acct { // bank account data
int num; // account num...
.
unsigned int fname_length = 0;
//fname length equals 30
file.read((char*)&fname_length,sizeof(unsigned int));
//fname contains random data as you would expect
char *fname = new char[fname_length];
//fname contains all the data 30 bytes long as you would expect, plus 18 bytes of random data on the end (intellisense display)
file....
This is out of deitel's c++ book and I'm trying to understand a bit more about why the continuation condition works and how it knows to quit. s1 and s2 are arrays so when s2 tries to assign the '\n' to s1 does it return null?
void mystery1( char *s1, const char *s2 )
{
while ( *s1 != '\0' )
s1++;
for ( ; *s1 = *s2; s1++, s2++ )
; // e...
Hi..!
I have a native C++ application (no fancy .Net stuff just C++). However it uses some optional .Net assemblies through mixed mode wrapper dll files. These dlls are loaded using delay load. Thing with mixed mode wrappers is they need to be fully trusted in order to load. So when the application try to use the dll if it is not there ...
Hi!
I have some vectors of class A objects:
std::vector<A> *V1;
std::vector<A> *V2;
etc
there is a function with a vector of pointers of A:
std::vector<A *> *arranged;
what I need to do is put the vectors from V1, V2 etc inside arranged without destroying them in the end, so I thought that a vector of pointers to those objects...
All the code below works. My device responds, C,7 is a reset. When I run this the second time it doesn't respond. If I manually turn my device off and on, then run this script again it works. But not if I press the button to run the script the second time.
RS232: 57600,8,N,1
Any ideas?? Is there any more information needed to solve thi...
Is there any reason to prefer static_cast<> over C style casting? Are they equivalent? Is their any sort of speed difference?
...
I want to declare a struct within a class which is private and I want to give a character value to a variable in the same struct, but I can't initialize it or cin it:
class puple
{
private:
struct p
{
char name[25];
int grade;
};
public:
puple(){};
void setme()
{
this->p::grade=99;
...
Does anyone have sample wxWidgets code to display a histogram? wxMathPlot seems to be working great for my other plotting needs, but now I have a requirement for a histogram.
Not being a UI developer I am a little bit like a fish out of water.
Any suggestions or references are greatly appreciated.
(I'd like it to be a dynamic histog...
I want to make a class A friend class of class B. I want to do this as these interact very much and A needs to change internals of class B (which I dont want to expose using public). But I want to make sure it has access to only a few selected functions not all the functions.
Example:
class A
{
};
class B
{
private:
void setState();...