Object-oriented example Analysis of C++
This article is about the object-oriented example analysis of C++. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
We should know that C++ has two kinds of member data: static,nostatic; three member functions: static,nostatic,virtual. In fact, for ordinary member functions, there is a this pointer in the parameter. This this pointer actually points to the object itself, through the this pointer. The C++ compiler will know which object called the member function of the class.
Are member variables and member functions stored together in C++ class objects? If not?
We should know that C++ has two kinds of member data: static,nostatic; three member functions: static,nostatic,virtual.
Here's a look at this case:
Class A {int a; int b;}; class B {int a; int b; static int c;}; class C {int a; int b; static int C: void func () {} static void pg () {}}; int main () {/ / 1. Analyze the memory An a; cout occupied by An object