Greetings from Portugal to everyone.
I'm building a project to a course in my university and i've stucked in some compiling error given by NetBeans and g++ in my dynamic array implementation. Glad if someone could give a hand to this.
Here is the code
#pragma once
#include <iostream>
#include <string>
#include "Edificio.h"
#include "Camiao.h"
using namespace std;
class Armazem:public Edificio
{
private:
Camiao **vecCamiao[];
int numCam, tamCam;
public:
Armazem();
Armazem(int c, string d);
Armazem(const Armazem &a);
virtual ~Armazem();
/*Armazem& operator =(const Armazem& p_arm);
bool operator ==(const Armazem& p_arm) const;
bool operator >(const Armazem& p_arm) const;
void escrever(ostream& out) const;*/
void insereCamiao(Camiao *vC);
void listaCamiao(Camiao *vc);
};
Armazem::Armazem(){}
Armazem::Armazem(int c, string d):Edificio(c,d)
{
tamCam = 50;
numCam = 0;
vecCamiao = new Camiao*[tamCam];
}
Armazem::~Armazem(){}
void Armazem::insereCamiao(Camiao* vC)
{
if(numCam == tamCam)
{
Camiao ** nVec = new Camiao*[2*tamCam];
tamCam = tamCam*2;
for(int i=0;i<numCam;i++)
{
nVec[i]=vecCamiao[i];
vecCamiao = nVec;
vecCamiao[i]=vC->clone();
numCam++;
}
}
}
void Armazem::listaCamiao(Camiao* vC)
{
for(int i=0; i<numCam; i++)
{
cout<<vecCamiao[i];
}
}
And the error code:
g++.exe -c -g -MMD -MP -MF build/Debug/Cygwin_4.x-Windows/main.o.d -o build/Debug/Cygwin_4.x-Windows/main.o main.cpp
Armazem.h: In constructor `Armazem::Armazem(int, std::string)':
In file included from main.cpp:7:
Armazem.h:35: error: incompatible types in assignment of `Camiao**' to `Camiao**[0u]'
Armazem.h: In member function `void Armazem::insereCamiao(Camiao*)':
Armazem.h:49: error: cannot convert `Camiao**' to `Camiao*' in assignment
Armazem.h:50: error: incompatible types in assignment of `Camiao**' to `Camiao**[0u]'
Armazem.h:51: error: cannot convert `Camiao*' to `Camiao**' in assignment
make[2]: Leaving directory `/cygdrive/c/Users/João/Documents/NetBeansProjects/TEsinf'
make[1]: Leaving directory `/cygdrive/c/Users/João/Documents/NetBeansProjects/TEsinf'
make[2]: *** [build/Debug/Cygwin_4.x-Windows/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)
Thank you in advance for your time responding to this tread.