template <class T>
void Arreglo<T> :: Registro (ifstream& Entrada) {
Entrada >> Cantidad;
Dealer = new T [Cantidad];
for (int i = 0; i < Cantidad; i++) {
[Code] .....
It says the following error when I comile it:
error: expected type-specifier before 'Detail'
(*(Dealer + i)).Modelo = new Detail[(*(Dealer + i)).AmountModels];
error: expected ';' before 'Detail'
class Secure { private: int seconds; bool isRUNNING; public: Secure(int seconds) {
[Code] .....
ERROR:
error C2276: '&' : illegal operation on bound member function expression
I read that due to explicit casting, threads cannot be created within a class. I'm trying to thread a scanning system to relieve stress on my main program/module, rather than having the scanner stunt their performance.
I am modifying a set of static variables inside of the class's member function. The static variables are private. An example of what I'm doing is as below,
utilities.h ----------- class utilities { private: static int num_nodes;
public: void parse_details(char* );
[Code] ....
I get a compilation error in the function void utilities::parse_details(char* filename)
which says: undefined reference to `utilities::num_nodes'
I get the following error in XCode whenever I try to access the member I created 'randomGen' in a separate class in a different header file. I have made sure to include the header file and have tried to access it through an object.
This is the code I enter when trying to access the method from randomiser.h in main.cpp. It is also an overloaded function with doubles and integers:
RandomG randomiser; randomiser.randomGen(); // 'Call to member function 'randomGen' is ambiguous'
This is the code inside randomiser.h:
#include <string> #include <iostream> using std::string; using std::cout; using std::endl; class RandomG {
[Code] ....
This is the error inside xcode: [URL] ....
I have tried seperating the code for the functions in another class (main.cpp) and then running and it seems to works, so I'm not sure why I can't put everything in the .h file and then access it?
I would like it in a seperate file so it doesn't clutter my main. I am writing a game with SDL so that might be confusing and I would like the window to have a random title and other random properties, so it would be easier to use a function.
I was just wondering how is this generally resolved. Let say you have this large function that runs in two modes. In the first mode it evaluates the data passed to a function as a map the the second mode it fills the map. example:
Code: template <typename Map, typename Int> void func(Map & map, Int i){ int z = 0; string zz;
[Code] ....
The point is i do not want to write a large function just to include different modes so i decided to set "i" to be a mode identifier. However when i want to compile my function given two modes i get an error since the modes are not recognized (obviously). if i pass map as
Code: map<int,int> and mode 1 i get an error here : Code: map[z] = z; besause map Code: map[z] expects z to be an int not string and the other way around (though in practice this cannot happen since i set the modes). So am i restricted to writing my function for both modes separately (polimorf.) or there is a way to make my example work.
i'm new to C++ i came across this bubblesort program earlier relating to class templates i was wondering how to make this into simple function templates
#include<iostream> #include<iomanip.h> #include<conio.h> #include<stdio.h> using namespace std; template <class t> class bubble
Why will i use explicit instantiation of a template, for a type? If I do not use explicit instantiation, the template is used to create the necessary function then what is the use of explicit instantiation?
In the above eg. explicit instantiation is done for char type. What is the use of this?? If the compiler can make use of the template to make a fn for char type.
I'm looking for a way to enter an unlimited amount of types in the <> part of a template function, I found Variadic templates but I'm not sure if it can do it, all the examples I've found are similar to the C argument list and don't use the <> part of the template at all.
I've written the following code and keep getting the errors:
Error1error C2244: 'Supermarket<temp>::operator =' : unable to match function definition to an existing declaration Error2error C2244: 'Supermarket<temp>::setName' : unable to match function definition to an existing declaration Error3error C2244: 'Supermarket<temp>::setArea' : unable to match function definition to an existing declaration
#ifndef SUPERMARKET_H #define SUPERMARKET_H
#include<string> #include<iostream> using namespace std;
[Code] .....
I moved the files to the .h file, and now I'm getting
#include <iostream> class Hello { public: void Test() {
[Code].....
As i know a non-constant member function cant be called inside a constant member function but how the above code has been compiled successfully and giving the expected result .
I'm getting this error in the 'my_free' function here "bp->s.size += p->s.ptr->s.size;" and "p->s.size += bp->s.size;" here. This doesn't make sense to me because it seems to be the correct way to access the union, and In the "my_malloc" function I use a similar call "p->s.size = nunits;" and that works fine.
I haven't had to modify them much for VS2010 so far. Right now, (I think) I have created the dialog box, and the menu as a class and a resource, respectively. However, when I call
I get an error 'DoModal' : is not a member of 'NewDialog'
I suppose somehow I need to link the menu to the dialog box?
I believe I've added the references, included the libraries and essentially followed the instructions. Apparently I'm not very clear on how to make resources interact with new classes.
I can't get this code to compile (using VS2010 and gcc4.6.1):
Code: #include <string> #include <vector> #include <algorithm> #include <boost/bind.hpp> class X { public: void foo( const std::vector<std::string>& v ){
[Code] ....
VS2010 presents an error message like "member function already defined or declared" and gcc something like "... function can not be overloaded" (very cryptic error message).
If I change the vector to foo to std::vector<int> and let bar() take an int, it works perfectly fine. And if I use boost
I mount a function (parameter - numeric vector; returns a string). However, this same function is used in several classes. To avoid that I keep duplicating the same code within these classes there is a way to do that as the code below?
std::string func( const vector<int> vec ) { //processamento return result; } class A {
I have an assignment in my OOP c++ class and I had to create a class called date and one of the member functions is a compare function that compares two dates that are taken in. It is suppose to be something like this:
Date d1(12,25,2003);// Dec 25, 2003 Date d2(5,18,2002);// May 18, 2002
d1.Compare(d2);// returns 1 (since d2 comes first) d2.Compare(d1);// returns -1 (calling object is d2, comes first)
Then if d1 and d2 are equal then it returns 0.
This is what he gave us to start with the function: