5
সি ++ মানচিত্রের অ্যাক্সেস ছাড়ার যোগ্যতা (কনস্ট্যান্ট)
নিম্নলিখিত কোড বলছেন যে যেমন মানচিত্র ক্ষণস্থায়ী constমধ্যে operator[]পদ্ধতি পরিত্যাগ কোয়ালিফায়ার: #include <iostream> #include <map> #include <string> using namespace std; class MapWrapper { public: const int &get_value(const int &key) const { return _map[key]; } private: map<int, int> _map; }; int main() { MapWrapper mw; cout << mw.get_value(42) << endl; return …