Get the App
SLTechnology News&Howtos  ›  Development  › 

Object-oriented example Analysis of C++

Shulou Source: shulou.com Published: 2022-06-03 12:40:29 11月15日 Update

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

Tags: Members objects functions variables pointers pointer static normal storage pointing compiler compilation analysis memory results methods data a. parameters that is Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Microsoft Redmi Docker MariaDB