Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Object-oriented example Analysis of C++

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report