Clean C++ Implementation
\n\nclass WordDictionary {\npublic:\n    \n    WordDictionary *child[26] = {};\n    bool isWord = false;\n    \n    WordDictionary() {\n        \n    }\n    \n 
\n```\nclass WordDictionary {\npublic:\n    \n    WordDictionary *child[26] = {};\n    bool isWord = false;\n    \n    WordDictionary() {\n        \n    }\n    \n    void addWord(string word) {\n        WordDictionary *root = this;\n        for(char &x : word) {\n            int ind = x-\'a\';\n\t\t\t// check if the child already exists, create if not\n            if(!root->child[ind]) root->child[ind] =  new WordDictionary();\n            root = root->child[ind];\n        }\n        root->isWord = true;\n    }\n    \n    bool search(string word) {\n        return search(word, 0, this);\n    }\n    \n\t/* Start with index 0 and recursively check if the string matches with our existing WordDictionary\n\tConditional validations for each index include,\n\t- If the index contains a character which is not "." -> then check if the character exists as child of root & proceed to the next index\n\t- If the index contains "." -> recursively call the search function for all the available 26 childs and proceed with the next index\n\t- Termination Condition : When we complete all the characters of the given word (index == word.length()), check if the root is a valid word here (using root->isWord) and return accordingly. */\n\t\n    bool search(string &word, int ind, WordDictionary *root) {\n        if(ind==word.length()) return root->isWord;\n        char x = word[ind];\n        if(x!=\'.\') {\n            return root->child[x-\'a\'] && search(word, ind+1, root->child[x-\'a\']);\n        }\n        else {\n            for(int i=0;i<26;i++) {\n                if(root->child[i] && search(word, ind+1, root->child[i])) return true;\n            }\n            return false;\n        }\n        return root->isWord;\n    }\n};\n```
['Trie', 'Recursion', 'C', 'C++']