D
david
Files:
pirma_lib.h - http://www.paste.lt/paste/de66c8b70084d3174d19eea1318d1993
pirma_lib.cpp - http://www.paste.lt/paste/050b9165168c61cc168f54a0193fe564
pirma.cpp - http://www.paste.lt/paste/6753553152fe92e939703393d79d6f67
I am using std:: in pirma_lib everywhere and this why I do not need to
use "using" and and std library which later could make some problems
and it still does now.
The problem is that when everything was in one file it was working
perfect and now I decided to put everything in separate files. This
way I made direct calls (std: and removed "using namespace std;"
from pirma_lib.cpp and this worked, I was able to compile this model (g
++ -Wall -ansi -pedantic -c pirma_lib.h);
But I was not able to compile the main code. Every line where I was
using "Aibe" class and it's methods was returning mistakes. But after
commenting "using namespace std;" in pirma.cpp I did not get any
error, but I should write to every cin, cout and etc std:: (make
direct calls).
The question would be how I should correctly move my class to separate
file, make module? Why it throwing mistakes with that std (This one
makes the most problems as I can see);
- - -
The second question.
In pirma_lib.h there is a line: bool isSubSet(Aibe &other);
But I would like to protect "other" Aibe instance and use "const Aibe
&other", but inside it I am using length() method. (but I could easily
get directly if I need). And this throws another mistake, that I can
not use length() method in this case, but I then declare length: int
length() cent; This should mean that length() can not change *this and
I think that now it should allow me to call it, but again I am still
getting mistake that it can not find such method at all. (It might be
that I still does not understand how it works) Could someone explain
why I can not call length() method?
This mistake:
pirma.cpp: In member function 'bool Aibe::isSubSet(const Aibe&)':
pirma.cpp:101: error: no matching function for call to 'Aibe::length()
const'
pirma.cpp:20: note: candidates are: int Aibe::length() <near match>
pirma_lib.h - http://www.paste.lt/paste/de66c8b70084d3174d19eea1318d1993
pirma_lib.cpp - http://www.paste.lt/paste/050b9165168c61cc168f54a0193fe564
pirma.cpp - http://www.paste.lt/paste/6753553152fe92e939703393d79d6f67
I am using std:: in pirma_lib everywhere and this why I do not need to
use "using" and and std library which later could make some problems
and it still does now.
The problem is that when everything was in one file it was working
perfect and now I decided to put everything in separate files. This
way I made direct calls (std: and removed "using namespace std;"
from pirma_lib.cpp and this worked, I was able to compile this model (g
++ -Wall -ansi -pedantic -c pirma_lib.h);
But I was not able to compile the main code. Every line where I was
using "Aibe" class and it's methods was returning mistakes. But after
commenting "using namespace std;" in pirma.cpp I did not get any
error, but I should write to every cin, cout and etc std:: (make
direct calls).
The question would be how I should correctly move my class to separate
file, make module? Why it throwing mistakes with that std (This one
makes the most problems as I can see);
- - -
The second question.
In pirma_lib.h there is a line: bool isSubSet(Aibe &other);
But I would like to protect "other" Aibe instance and use "const Aibe
&other", but inside it I am using length() method. (but I could easily
get directly if I need). And this throws another mistake, that I can
not use length() method in this case, but I then declare length: int
length() cent; This should mean that length() can not change *this and
I think that now it should allow me to call it, but again I am still
getting mistake that it can not find such method at all. (It might be
that I still does not understand how it works) Could someone explain
why I can not call length() method?
This mistake:
pirma.cpp: In member function 'bool Aibe::isSubSet(const Aibe&)':
pirma.cpp:101: error: no matching function for call to 'Aibe::length()
const'
pirma.cpp:20: note: candidates are: int Aibe::length() <near match>