bool equalAlphabets(const Language& language1, const Language& language2){ Alphabet alphabet1 = language1.getAlphabet(); Alphabet alphabet2 = language2.getAlphabet(); if (alphabet1.size() != alphabet2.size()){ throw std::invalid_argument("Alphabets must be of the same size"); } return ((alphabet1 == alphabet2)); }
Language::Language(const Language &language) : _alphabet(language.getAlphabet()){ for(unsigned int i = 0; i < language.size(); i++){ Word* otherWord = language.getWord(i); Word *word = new Word(*otherWord); this->addWord(word); } }