Hi,
I have a template class, C_Foo<T>, which is specialised in a number of ways.
struct Bar_Base { ... };
struct Bar_1 : public Bar_Base { ... };
struct Bar_2 : public Bar_Base { ... };
struct Bar_3 : public Bar_Base { ... };
class C_Foo<T> { ... };
class C_Foo_1 : public C_Foo<Bar_1> { ... };
class C_Foo_2 : public C_Foo<Bar_2> { .....
I'm using C++ to understand how exactly pointers work. I have this piece of code using arrays, which I'm using just to understand how the equivalent works with pointers.
int main() {
int arr[10] = {1,2,3};
char arr2[10] = {'c','i','a','o','\0'};
cout << arr << endl;
cout << arr2 << endl;
}
However when I run th...
Lets say I have two classes like the following:
Class A
{
public:
..
private:
int length;
}
Class B: public Class A
{
public:
..
private:
float length;
}
What I would like to know is:
1) Is OVERRIDING OF BASE CLASS DATA MEMBERS allowed?
2) If yes, is it a good practice?
3) If no, what is the best way to extend the type of the data...
I want to make a function which moves items from one STL list to another if they match a certain condition.
This code is not the way to do it. The iterator will most likely be invalidated by the erase() function and cause a problem:
for(std::list<MyClass>::iterator it = myList.begin(); it != myList.end(); it++)
{
if(myCondition(*it))...
I do not see "Create GUID" option under the menu item Tools -> . I am using Visual Studio 2005 .
Do I have to install anything for that .
...
The question could be subjective, so the syntax of
std::ostream& operator << (std::ostream & o, const SomeClass &a) {
return o << a.accessor().. ;
}
When do you normally define this for the classes that you write, when do you avoid writing this friend function for your class.
...
Is there an equivalent in Java to the passing on const references in C++?
Isn't leaving out the "constness" misleading in regard to the method signature?
...
I come from a c# background where everything has its own namespace, but this practice appears to be uncommon in the c++ world. Should I wrap my code in it's own namespace, the unnamed namespace, or no namespace?
...
Hi, I'm currently trying out some questions just to practice my programming skills. ( Not taking it in school or anything yet, self taught ) I came across this problem which required me to read in a number from a given txt file. This number would be N. Now i'm suppose to find the Nth prime number for N <= 10 000. After i find it i'm supp...
I am using the MFC Feature Pack and I have some buttons on a ribbon bar, instances of CMFCRibbonButton. The problem is that I would like to enable and disable some of them in certain conditions, but at runtime. How can I do this? because there is no specific method for this...I heard that a solution would be to attach/detach the event ha...
Can someone please provide me with a hint on how to draw a line graph in vc++ 6.0?
...
In several C++ examples I see a use of the type size_t where I would have used a simple int. What's the difference, and why size_t should be better?
Thank you folks.
...
Is there any solution other than the ugly ADO as it is not good and badly documented?
...
I have a dll which builds properly in VS 2005 . The dll includes "afxdisp.h" header file which is present in the default location (C:\Program Files\Microsoft Visual Studio 8\VC\atlmfc\include) .
// piece of code
ifndef _AFX_NO_OLE_SUPPORT
#include "afxdisp.h"
endif
// ends
The same dll is not building in Visual Studio 2008 . ...
I am trying to work out the format of a password file which is used by a LOGIN DLL of which the source cannot be found. The admin tool was written in AFX, so I hope that it perhaps gives a clue as to the algorithm used to encode the passwords.
Using the admin tool, we have two passwords that are encoded. The first is "dinosaur123456789"...
So, the question is: I get some notifications I don't want to get. But I don't know for what file/dir I got them. Is there a way to know why given notification was fired?
If you think about ReadDirectoryChangesW, please include a meaningful code sample.
...
I have a Qt/C++ project and an old VB6 project.
The user base might not have permissions to HKEY_LOCAL_MACHINE due to lack of administrator rights but I need to update a registry entry.
How can I get a list of the groups to which a user belongs?
...
In my numerical simulation I have code similar to the following snippet
double x;
do {
x = /* some computation */;
} while (x <= 0.0);
/* some algorithm that requires x to be (precisely) larger than 0 */
With certain compilers (e.g. gcc) on certain platforms (e.g. linux, x87 math) it is possible that x is computed in higher than dou...
I need a library that can detect objects in an image (uses edge detection). This is NOT related to captchas. I am working on an MTGO bot that uses OCR and that works in any screen resolution. In order for it to port to any screen resolution my idea is to scan down narrow range on a results page (the cards that a player has can be listed ...
While designing an interface for a class I normally get caught in two minds whether should I provide member functions which can be calculated / derived by using combinations of other member functions. For example:
class DocContainer
{
public:
Doc* getDoc(int index) const;
bool isDocSelected(Doc*) const;
int getDocCount() const...