I also want to talk about object-oriented programming.

Source: Internet
Author: User

As a first doorProgramThe design language is C ++, and I will also talk about OOP for students who have been using the current family of science and technology.

When we were young, parents did what they could to cultivate us. For example, take a meal by yourself.

Mom would patiently tell us that she grabbed the bowl with her hands and opened the lid with another hand. Then she picked up the rice spoon and dug a proper size of rice cake into the bowl, repeat a few times, set aside the spoon and cover the lid based on your food intake. OK. It's a good meal. This is a process. Mom just teaches you how to do it. Mom didn't say that. We need a person, a bowl, a spoon, a pot that can cook rice and some rice. Now we have prepared it. Then we will cook it in a pot.

I also know that when I started to contact C ++ when I was a freshman, it was normal that most of your life was a process, however, there are exceptions. I like fishing. When I am fishing, I always consider fish hooks, fish lines, and bait.

So how to switch the process and object ideas.

1. Start to consider the different focus, the process cares about action, and the object cares about entity.

2. Process and object considerations during implementation

The following is an example of TCP socket client connection.

Process

1. Set the socket description Structure

2. Set to open socket

3. connect to a remote TCP Server

Object

For a tcpsocket object, we may need a session object to maintain a session. A session may be related to several tcpscoket, such as ftp. A session has two TCP connections and one controls one data.

Summarize with my own words

Process, how to do it, and how the process is.

What is the relationship between objects and objects?

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.