New article – How inheritance, encapsulation and polymorphism work in C++
This concludes a month of work. Somehow I, again, ended up with huge article and explains lots of different things.
In this article, I am explaining how the three whales of OOP implemented in C++. How encapsulation works. How overloading of methods works. What is the structure of C++ object compared to C structure. How polymorphism works. What’s the structure of virtual methods table and how inheritance affects it. And many other things. Hope you will find it interesting. Read it here.
Once I had question, I haven’t find answer yet, so I want ask you?
When the sizeof of class isn’t equal to sizeof of object of that class?
For example:
class A
{
};
A a;
sizeof(A) != sizeof(a);
Thanks
To be honest I have no idea I think I saw someone mentioning this. Anyway, I’ll post the answer here if I run into it.
how encapsulation work in c++