class TestClass
{
public:
TestClass(int i) { i = i; };
private:
int i;
}
class TestClass2
{
private:
TestClass testClass;
}
Why does the above code compile fine even when we have not provided a default constructor?
Only if someone instantiates TestClass2 elsewhere in the code, do we get a compile error. What is the compil...
On page 340 of the C++ Programming Language: Special Edition, Stroustrup writes...
The semantic checking of a default argument for a template parameter is done if and (only) when that default argument is actually used. In particular, as long as we refrain from using the default template argument Cmp<T> we can compare() strings of a type...
Is there any way to make a Java program (in Windows) that just acts as a wrapper around a PE
(.exe), passing all stdin input to the program and writing out to stdout everything that the PE writes out.
I need this because the interface for a program only allows Java classes, but I want it to run some code that I've put together in C++.
...
Ok, I guess that this is a very absurd/basic question, but still:
class m
{
public:
void f(int ***);
/***/
}
void m::f(int ***a = NULL)
{
/***/
}
The call to f (as well as any function which has default values for all the arguments) doesn't accept 0 arguments. Why? How should I format the declaration then?
Thanks already.
...
I posted earlier about how to do this, and got some great replies, and have managed to get the code written based off the MSDN example. However, it does not seem to be working properly. Its printing out the ERROR_ACCESS_DENIED message, but im not sure why as I am running it as a full admin. I was initially trying to create a USER_PRIV_AD...
hi all,
I need to read an image file in C/C++. It would be very great, if some one can post the code for me.
I work on gray scale images and the images are JPEG. I would like to read the images into a 2D array which will make my work easy.
Thanks in advance
...
Where can I read about sbrk() in some detail?
How does it exactly work?
In what situations would I want to use sbrk() instead of the cumbersome malloc() and new()?
btw, what is the expansion for sbrk()?
...
Is there anyway to give a newly created user from NetUserAdd() remote desktop access and/or administrative rights? I know it is possible, at least for Remote Desktop, and I have been reading through the MSDN but nothing seems to hint at what is required to be set for it to work.
...
In C, if I wanted to create a matrix struct, I would use:
struct matrix {
int col, row;
double data[1]; // I want the matrix entries stored
// right after this struct
}
Then I can allocate it with
matrix* allocate_matrix(int row, int col) {
matrix* m = malloc(sizeof(matrix) + sizeof(double) * (row * col - 1));...
I'm trying to read data from a text file, clear it, and then write to it, in that order using the fstream class.
My question is how to clear a file after reading from it. I know that I can open a file and clear it at the same time, but is there some function I can call on the stream to clear its contents?
...
So what happens to a pointer if you release an object owned by auto_ptr but do not actually assign it to a raw pointer? It seems like it's supposed to be deleted but it never gets the chance to. So does it get leaked out "into the wild"?
void usingPointer(int* p);
std::auto_ptr<int> point(new int);
*point = 3;
usingPointer(point.rele...
Is there anyways to have a define increment every time you use it?
For example
int a = ADEFINE;
int b = ADEFINE;
a is 1 and b is 2.
...
So I think I almost got it. I create my dummy account with one function, and wrote a second function to add it to the Remote Desktop group. Problem is, the Administrator account is the one logged in, so I am not sure how to specify what account to add to the group. Here is my code...
The user is being created properly...
void AddRDPUs...
I have a problem with this very simple block of code. please give me your advice .
(My this problem is solved, and in solving this problem the person having id stakx really helped me, the only problem was that i was using stack< treeNode >, when i saw the push method of the stack carefully, there is a copying process when i write head->o...
My question ist related a bit to this one.
I want to overload the operator << for some class and I found two different notations that both work:
template <class T>
class A{
T t;
public:
A(T init) : t(init){}
friend ostream& operator<< <> (ostream &os, const A<T> &a); //need forward declaration
//template <class U> friend ostrea...
I used to use List.h to work with lists in C++, but are there any similar libraries in .Net ? Becouse I can't use List.h for managed types.
...
I've the following C++ array:
byte data[] = {0xc7, 0x05, 0x04, 0x11 ,0x45, 0x00, 0x00, 0x00, 0x00, 0x00};
How can I know how many items there are in this array?
...
I'm not using any features of the MSVCRT100.dll (I don't even know if there are new features).
...
Hi,
I have std::list<Info> infoList in my application that is shared between two threads. These 2 threads are accessing this list as follows:
Thread 1: uses push_back(), pop_front() or clear() on the list (Depending on the situation)
Thread 2: uses an iterator to iterate through the items in the list and do some actions.
Thread 2 is i...
Possible Duplicates:
How much mathematics and physics should a programmer know?
What are the core mathematical concepts a good developer should know?
I would like to study mathematics to be a better programmer (Web Developer) but which maths should I study e.g. Algebra, Calculus, Discrete Math etc?
I plan to work with Algori...