Anonymous
BTW what is CRTP?
Anonymous
Nikal bhosdk pehli fursat mein
Anonymous
Anonymous
Nikal BC pehli fursat mein
Dmitry
Its broken
klimi
is that english
Anonymous
Anonymous
Yup chutiye
Anonymous
He is sending a video lol
Anonymous
If we use a base class pointer to point to the base class object and call a virtual function using it. Then it would be late binding. But, will that be a run time polymorphism
Anonymous
Now I know what it means
Anonymous
Now I know what it means
No. I didn't.
Anonymous
So, what are the necessay conditions for run-time polymorphism
Anonymous
1. Inheritance 2. virtual functions in base class and what else?
Anonymous
Implementation of virtual functions in derived classes
Anonymous
1. Inheritance 2. virtual functions in base class 3. Overriding of the virtual function and anying else? I think using the base class pointer to point to its own object and its derived object also counts.
Anonymous
* I think using the base class pointer to point to its own object OR its derived object also counts.
Anonymous
So, can you provide an example with the top 3 holding true and not he last point that I mentioned.
Anonymous
So, can you provide an example with the top 3 holding true and not he last point that I mentioned.
I cannot Because it's not a condition for classes to be polymorphic It's the usage of polymorphism itseld
Anonymous
isn't there any other usage
Anonymous
goin' to sleep.
Anonymous
Whenever we have base *b = new Derived(); then if we call any non-virtual function as b->fun(), then at compile time it will run the fun() of base class due to Early Binding. If we make fun() as virtual then it will run the child class fun() due to RUN-time poly. Same is the case with destructor as well. So, we need to make destructor is virtual so that first the child class destructor is executed first. Is it completely correct Or do I need to add more. KINDLY REPLY!!
Anonymous
I think it's ok
Abhishek
/notes
Anonymous
/get best-book
Anonymous
/get great
Anonymous
/get
Dede
/notes
/notes
Ader
hi
Vladimir
hi
http://www.nohello.com/
Anonymous
#include<stdio.h> typedef struct demo{ int i; float f; char c; }demo; void main() { demo d; printf("%d",sizeof(d)); } Output is 12
Anonymous
#include<stdio.h> typedef struct demo{ int i; float f; char c[8]; }demo; void main() { demo d; printf("%d",sizeof(d)); } Output is 16
Anonymous
Why there is 12 output instead of 9
olli
Why there is 12 output instead of 9
compiler are free to add additional bytes to pad the structure
Kakashi Hatake
How the additional bytes get added
Kakashi Hatake
Is there any relations to all??
olli
Depends on your architecture and compiler settings. In many cases it's padded according to the biggest but at most to pointer size
Anonymous
compiler are free to add additional bytes to pad the structure
Means if we use double instead of int then the output will be 24 because it pads according to the highest byte I.e it pads all type as 8 byte ?
olli
Means if we use double instead of int then the output will be 24 because it pads according to the highest byte I.e it pads all type as 8 byte ?
always depends on the compiler and setting. Many compiler try to align every member based on its size (at most pointer size) and the complete structure based on the biggest member (at most pointer size)
Accel
Cppreference.com
I've seen but I can't understand
Anonymous
Does late binding occur when virtual function of derived class is called by object of derived class? Can we call it Run-time polymorphism too?
Nani
/saved
Anonymous
https://imgflip.com/i/36jmq7
Anonymous
Can you help me to learn C programming and data structures first to last ? please
Anonymous
Anyone!
Anonymous
That q is like finding mode in table
MᏫᎻᎯᎷᎷᎬᎠ
I'm little bit worried about the pain of reorganizing the existing projects after C++20
Anonymous
Hi
klimi
Hi
Hi
YVEF
HI
MᏫᎻᎯᎷᎷᎬᎠ
Why?
Inclusion mechanism on codes takes too long to compile. And modules(C++20 features) do not. And there are like millions of software written in C++ and every one of them consist of (at least) thousand of lines. Devs have to rewrite their projects(and the legacy ones) to adapt modules, which takes too long. Or they have to stick with the painful long compilation time that is caused by the #include mechanism
MᏫᎻᎯᎷᎷᎬᎠ
It's a hard choice, I think
Anonymous
Where I can learn Python?
MᏫᎻᎯᎷᎷᎬᎠ
Where I can learn Python?
Obviously in a python group
Anonymous
Thanks. I have a good knowledge about c but don't know what is a python.
Anonymous
If I have a C function taking a pointer to a struct, can I supply a C++ struct to it? (Since they are different, I don't know). Thanks in advance.
Pavel
If I have a C function taking a pointer to a struct, can I supply a C++ struct to it? (Since they are different, I don't know). Thanks in advance.
I'm not sure, but I think that if the struct is passing std::is_pod criteria then it can be used in functions that expect a C struct. You can make a template wrapper function where you can check that. Or simply have an assert like this if it's only for one struct (so if someone adds something potentially unsafe, the code won't compile). static_assert(std::is_pod<ParamType>(), "ParamType should be pod type");
Pavel
Because if it's not pod type, it can have some customized behavior that couldn't be expected in that C function (some custom copy constructor, can have pointer to the virtual table, etc.), and C function can just memcpy the struct or somehow manipulate its memory.
Anonymous
Anonymous
Any one pls solve f
Anonymous
Guys any one pls
Dima
Any one pls solve f
/warn Read the rules twice
YVEF
It's a hard choice, I think
Okey. Thanks. I think what in 98 was better:))
Anonymous
Hello group
︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎ ︎︎
Hello
Onkar
#best-book
Onkar
#cppbook
Dzung
Hi there, anyone knows what's the most effective way to check undefined behavior?