Witam,
mam problem z zadaniem :
chce zacząć wypełniać metody, ale wyskakuję dużo błędów, więc proszę o pomoc w naprawieniu metod.
class Set
{
char tab[];
public:
Set (char tab[]);
int size();
bool contains(char znak) const;
char insert(char znak);
char remove(char znak);
};
char Set::insert (char znak)
{
}
char Set::remove (char znak)
{
}
char Set::size()
{
return sizeof(tab);
}
char Set::contains (char znak)
{
}
#include <iostream>
int main() {
Set set = Set().insert('a').insert('b').remove('b').remove('c');
std::cout << set.size() << std::endl << std::boolalpha;
std::cout << set.contains('a') << " " << set.contains('b') << " " << set.contains('c') << " " << set.contains('d') << std::endl; }
błedy wyskakujące :
||=== Build file: "no target" in "no project" (compiler: unknown) ===|
:\10.2.11 Set.cpp|34|error: prototype for 'char Set::size()' does not match any in class 'Set'|
\KLASY\10.2.11 Set.cpp|9|error: candidate is: int Set::size()|
\KLASY\10.2.11 Set.cpp|38|error: prototype for 'char Set::contains(char)' does not match any in class 'Set'|
\\KLASY\10.2.11 Set.cpp|10|error: candidate is: bool Set::contains(char) const|
\10.2.11 Set.cpp||In function 'int main()':|
KLASY\10.2.11 Set.cpp|52|error: no matching function for call to 'Set::Set()'|
KLASY\10.2.11 Set.cpp|8|note: candidate: Set::Set(char*)|
\KLASY\10.2.11 Set.cpp|8|note: candidate expects 1 argument, 0 provided|
KLASY\10.2.11 Set.cpp|2|note: candidate: constexpr Set::Set(const Set&)|
KLASY\10.2.11 Set.cpp|2|note: candidate expects 1 argument, 0 provided|
\KLASY\10.2.11 Set.cpp|2|note: candidate: constexpr Set::Set(Set&&)|
KLASY\10.2.11 Set.cpp|2|note: candidate expects 1 argument, 0 provided|
||=== Build failed: 5 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|
- screenshot-20191227154306.png (89 KB) - ściągnięć: 119
Set set = Set(); set.insert('a'); set.insert('b'); ...