ago i read an article about "How to call a private constructor out side of class?", which explained a way to do that. But right now, i couldn't find it. did anyone know anything about it?
http://bloglitb.blogspot.com/2010/07/access-to-private-members-thats-easy.html
why do you "need" to call/invoke a private constructor ? 🤔
I don't need that in the production or any other projects. That is just fun for me.
How to access private member variables(yeah i know that could be UB, but it is fun): class A { int value; }; class B : A {}; B b; *((int*)(A*)&b) = 10;
You don't even need B for that something like this will be the same (and this is UB) A a; *((int*)&a) = 10;
I need it to show how you could even touch the vtable
But that didn't had a vtable
There's no vtable in this case, since no virtual functions
What makes it UB?
Hmmm, after you mentioned it I don't see why, however I'm not sure if its not
Обсуждают сегодня