C++
x
29
1
typedef int string;
2
char* dictionary = nullptr;
3
int DICTIONARY_SIZE = 0;
4
5
template <typename a, typename b>
6
class Dictionary{};
7
8
template <typename Key, typename E>
9
class BDictionary : public Dictionary<Key, E> {
10
public:
11
BDictionary(Key E)
12
{
13
14
}
15
16
~BDictionary(Key E)
17
{
18
delete[] dictionary;
19
}
20
21
};
22
23
BDictionary<int, string> myIntStrDict(DICTIONARY_SIZE);
24
BDictionary<string, int> myStrIntDict(DICTIONARY_SIZE)
25
26
;
27
28
int main(){}
29
$ g++ prog.cc -Wall -Wextra -std=c++11 -pedantic
Start
prog.cc:11:17: error: declaration of 'Key E' shadows template parameter 11 | BDictionary(Key E) | ~~~~^ prog.cc:8:25: note: template parameter 'E' declared here 8 | template <typename Key, typename E> | ^~~~~~~~ prog.cc:16:18: error: declaration of 'Key E' shadows template parameter 16 | ~BDictionary(Key E) | ~~~~^ prog.cc:8:25: note: template parameter 'E' declared here 8 | template <typename Key, typename E> | ^~~~~~~~ prog.cc:16:1: error: destructors may not have parameters 16 | ~BDictionary(Key E) | ^ prog.cc: In constructor 'BDictionary<Key, E>::BDictionary(Key)': prog.cc:11:17: error: declaration of 'Key E' shadows template parameter 11 | BDictionary(Key E) | ~~~~^ prog.cc:8:25: note: template parameter 'E' declared here 8 | template <typename Key, typename E> | ^~~~~~~~ prog.cc: In instantiation of 'BDictionary<Key, E>::BDictionary(Key) [with Key = int; E = int]': prog.cc:23:54: required from here prog.cc:11:17: warning: unused parameter 'E' [-Wunused-parameter] 11 | BDictionary(Key E) | ~~~~^
1
Finish