This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Newbie question: I cant declare an object with a constructor made by myself.


Hi,

im trying to compile a little code which declares an object of a class
conctructed by myself.

Using the command "g++ Prueba3.cpp main.cpp -o main" i get this error (it is
a translation from my g++ compiler in spanish):

error: There isn't any coincident function for the calling to
âCPrueba3::CPrueba3(int&)â
Prueba3.h:5: note: the candidates are: CPrueba3::CPrueba3()
Prueba3.h:5: note:                     CPrueba3::CPrueba3(const CPrueba3&)
 


The files are these:

//////// Prueba3.h /////////

class CPrueba3
{

private:
int numero;

public:
CPrueba(int num);

};


//////// Prueba3.cpp /////////

#include "Prueba3.h"

CPrueba3::CPrueba3(int num)
{
numero=num;
}

/////// main.cpp ///////////

#include "Prueba3.h"

int main()
{

int n=8;
CPrueba3 prueba(n);  // i get the error on this line

}

br.
GARFF
-- 
View this message in context: http://www.nabble.com/Newbie-question%3A-I-cant-declare-an-object-with-a-constructor-made-by-myself.-tf4248535.html#a12090806
Sent from the gcc - Help mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]