0
What is the error..i didn't understand!!
12 Respostas
+ 2
U r not using the variable pb thats why it is giving warning for unuse variable.
If you want to show pb as output then add
cout<<pb; or cout<<sizeOf(pb);
+ 1
u cant use static cast with unrelated class, cause they dont have same memory layout
+ 1
__n
checking out what static_cast and reinterpret_cast actually do helps more than asking on SoloLearn and waiting for an answer
static_cast: https://en.cppreference.com/w/cpp/language/static_cast
reinterpret_cast: https://en.cppreference.com/w/cpp/language/reinterpret_cast
Also, when you have another question, instead of asking it in the same thread, please make a new one. Or even better, try to put all the questions you have about a certain topic in the same question.
+ 1
XXX I didn't had another question i asked question of same code so..
and i was confused in that so i asked directly..on sololearn
0
What's work of problem
0
Can u tell me why we can't use static_cast here???
0
Martin Taylor u mean static_cast is also applicable here..then??
0
https://code.sololearn.com/c3Tl8me77fpH/?ref=app
Now i replaced static in place of reinterpret ...now why its giving me error??
0
Ohh thnx..Lily Mea
0
__n
that's what I addressed in the "Or, even better...." line. I'm saying that before asking a question, think for a minute and write all your questions at once. This is because when someone else has the same problem, it becomes easier to just link your question. It's okay that you asked a question in the same thread because the code was same, I'm just saying that it's always better to write all your questions at once in the questiom description.
Happy coding.
0
Okayy..thnk u😁
0
Gg