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

What is the difference between C++ and C language?

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Most people do not understand the knowledge points of this article "what is the difference between C++ and C language", so the editor summarizes the following contents, with detailed contents and clear steps, which can be used for reference. I hope you can get something after reading this article. Let's take a look at this "what is the difference between C++ and C language" article.

1. The difference between structures is 1.1. The struct keyword is no longer needed on the type, but you can simply use the structure name # include # includeusing namespace std;struct MM {char name [20]; int age;}; int main () {struct MM girl; MM mm;//C++ does not need the struct keyword return 0;} 1.2. Functions are allowed to exist in the C++ structure

Declare in the structure, implement it outside the structure, of course, it can be implemented directly in the structure.

The function in the structure accesses data, which can be accessed directly

Learn to call in the same way as data members

Object (structure variable). Members

Object pointer-> member

(* object pointer). Members

The usage of C++ is the same as that of C language when there is no constructor and permission limit.

# include # includeusing namespace std;struct MM {/ / attribute / / data member char name [20]; int age; / / behavior (method) / / member function void print () {cout

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