# Config Parser ```cpp using K = key_type; using T = value_type; class config_base { config_base() {} public: virtual T get(const K) = 0; virtual void set(const K, const K) = 0; }; class PLC_confing_parser : virtual public config_base { PLC_confing_parser() {} public: PLC_confing_parser &Instance() { static PLC_confing_parser c; // singleton return &c; } virtual T get(const K) override {} virtual void set(const K, const K) override {} }; class VGA_confing_parser : virtual public config_base { VGA_confing_parser() {} public: virtual T get(const K) override {} virtual void set(const K, const K) override {} // overwrite // override }; // 匈牙利 class IConfigBase { // https://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/f8d4fe46-6be8-44c9-8823-615a21d17a61 // WOW64 //lost fit bit? // int * p = new int(42); // // C89: // // include <stdlib> // int* const p = malloc(); // decltype(auto) p = malloc(); // int* const // auto p = malloc(); // int* // 45648949 *((int*)45648949) // (int*)p; }; /// https://godbolt.org/z/aY4TGeceh /// https://godbolt.org/z/xdxP5c5Gs](https://godbolt.org/z/5a3q7e9Y8) // OSInfo class IOSInfo { }; // ... //////////////////////////////////////// class config_base { public: config_base() {} virtual int get(const int) {} virtual void set(const int, const int) {} }; class PLC_confing_parser : virtual public config_base { /// ... }; class VGA_confing_parser : virtual public config_base { public: VGA_confing_parser() {} virtual int get(const int) override {} virtual void set(const int, const int) override {} }; int main() { VGA_confing_parser v; v.~VGA_confing_parser(); v.get(1); // UB. } // https://godbolt.org/z/5PPfreM9q // https://stackoverflow.com/questions/920500/what-is-the-purpose-of-cxa-pure-virtual https://godbolt.org/z/GEKfzqe7c ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up