|
|
Tocka() {};
|
|
codekiddy (422) Mar 11, 2012 at 9:52pm E zemljače, trebas defaultni konstruktor:D ubaci ga u klasu Tocka: |
In constructor 'Trokut::Trokut(const Tocka&, const Tocka&, const Tocka&)': 44:60: error: no matching function for call to 'Tocka::Tocka()' 44:60: note: candidates are: 24:1: note: Tocka::Tocka(Tocka&) 24:1: note: candidate expects 1 argument, 0 provided 19:1: note: Tocka::Tocka(float, float) 19:1: note: candidate expects 2 arguments, 0 provided 44:60: error: no matching function for call to 'Tocka::Tocka()' 44:60: note: candidates are: 24:1: note: Tocka::Tocka(Tocka&) 24:1: note: candidate expects 1 argument, 0 provided 19:1: note: Tocka::Tocka(float, float) 19:1: note: candidate expects 2 arguments, 0 provided 44:60: error: no matching function for call to 'Tocka::Tocka()' 44:60: note: candidates are: 24:1: note: Tocka::Tocka(Tocka&) 24:1: note: candidate expects 1 argument, 0 provided 19:1: note: Tocka::Tocka(float, float) 19:1: note: candidate expects 2 arguments, 0 provided In copy constructor 'Trokut::Trokut(const Trokut&)': 54:32: error: no matching function for call to 'Tocka::Tocka()' 54:32: note: candidates are: 24:1: note: Tocka::Tocka(Tocka&) 24:1: note: candidate expects 1 argument, 0 provided 19:1: note: Tocka::Tocka(float, float) 19:1: note: candidate expects 2 arguments, 0 provided 54:32: error: no matching function for call to 'Tocka::Tocka()' 54:32: note: candidates are: 24:1: note: Tocka::Tocka(Tocka&) 24:1: note: candidate expects 1 argument, 0 provided 19:1: note: Tocka::Tocka(float, float) 19:1: note: candidate expects 2 arguments, 0 provided 54:32: error: no matching function for call to 'Tocka::Tocka()' 54:32: note: candidates are: 24:1: note: Tocka::Tocka(Tocka&) 24:1: note: candidate expects 1 argument, 0 provided 19:1: note: Tocka::Tocka(float, float) 19:1: note: candidate expects 2 arguments, 0 provided |
Trokut (const Tocka &E,const Tocka &D,const Tocka &F);
Tocka(const Tocka &A);
But the one provided by the compiler already does what you want.
vlad from moscow wrote: |
---|
I consider this as a bug of the compiler. The declarationTrokut (const Tocka &E,const Tocka &D,const Tocka &F); does not require any default constructor, because parameters of the constructor are declared as references |
|
|
ne555 (2596) Mar 11, 2012 at 10:10pm Your "copy constructor" is incorrect. It should be Tocka(const Tocka &A) ; But the one provided by the compiler already does what you want. |
ne555 (2596) Mar 11, 2012 at 10:10pm It's not about the parameters, but about the members. class Trokut { private: Tocka A,B,C; //¿how are these constructed? If you omit the initialization list, the best guess of the compiler is to use the default constructors for them. But there is no default constructor (and again, maybe it shouldn't be one) |
|
|
|
|
E zemljače, trebas defaultni konstruktor:D ubaci ga u klasu Tocka: Tocka() {}; Ovako: 1 2 3 4 5 6 7 8 9 class Tocka { public: float x; float y; Tocka() {}; Tocka(float a, float b); Tocka(Tocka &A); }; I trebalo bi radit hehe :) |
|
|
It is the definition of the constructor that is incorrect. So the compiler shall show errors for that code that is indeed incorrect. But it points to fully correct code and says that it contains errors. It iis a severe bug of the compiler. |
There is nothing wrong with the code in the constructor's body. |