What does the “private” modifier do?

There’s a certain amount of misinformation here: “The default access modifier is not private but internal” Well, that depends on what you’re talking about. For members of a type, it’s private. For top-level types themselves, it’s internal. “Private is only the default for methods on a type” No, it’s the default for all members of … Read more

How do you initialize static data members, similar to static constructors? [duplicate]

To get the equivalent of a static constructor, you need to write a separate ordinary class to hold the static data and then make a static instance of that ordinary class. class StaticStuff { std::vector<char> letters_; public: StaticStuff() { for (char c=”a”; c <= ‘z’; c++) letters_.push_back(c); } // provide some way to get at … Read more

How to generate RSA private key using OpenSSL?

#include <openssl/rsa.h> #include <openssl/pem.h> const int kBits = 1024; const int kExp = 3; int keylen; char *pem_key; RSA *rsa = RSA_generate_key(kBits, kExp, 0, 0); /* To get the C-string PEM form: */ BIO *bio = BIO_new(BIO_s_mem()); PEM_write_bio_RSAPrivateKey(bio, rsa, NULL, NULL, 0, NULL, NULL); keylen = BIO_pending(bio); pem_key = calloc(keylen+1, 1); /* Null-terminate */ BIO_read(bio, … Read more

How to access private methods without helpers?

If there is extended RTTI info generated for the class private members – fields and/or methods you can use it to gain access to them. Of course, accessing through RTTI is way slower than it was through class helpers. Accessing methods: var Base: TBase2; Method: TRttiMethod; Method := TRttiContext.Create.GetType(TBase2).GetMethod(‘UsefullButHidden’); Method.Invoke(Base, []); Accessing variables: var Base: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)