Thinking in C ++ reading log (4)

Source: Internet
Author: User

Chapter 4 data abstraction

The so-called data abstraction mainly focuses on struct and class. This chapter details the origins of the class and the specific procedures and causes of its conversion from struct. Read carefully to have a deeper understanding of the class.

The knowledge points in this chapter are concentrated and difficult to explain. There are many programming ideas and methods, so this time we will not write "recommendation points". instead raised several questions here, to facilitate reading as much as possible. If you can answer all these questions, you will have mastered the main content of this chapter. This chapter can be quickly passed over. Otherwise, you can select the part you are interested in and read it with questions. This gives you more directionality during reading.

 

1What is the storage principle of heap?

For example, a string can be filled in with strings without a limited space, while a vector can be set to whatever type it is willing to put. How can we achieve this?

You can get the answer from the first program instance.

 

2. structWhat is the difference with class?

C ++Why should I use class instead of struct? (Where is the superiority of class, but is it actually different from struct ?).

This is the center of this chapter.

 

3. # ifdef # ifndef # endifWhat is it?

 Here, by the way, # pragma once is introduced in the new standard, which can be replaced by # ifndef and # endif in the header file. It is easier to write.

# The Pragma family also has many other features. For more information, see.

 

4. Void * pointer operation

How can I convert the void * type to int * or char * output as needed? What is the role and value of the void * pointer?

You will be able to understand these examples in this chapter.

 

I only want to write so much, I hope it will help you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.