How to go about object-oriented programming __java

Source: Internet
Author: User

I believe most software developers know the word object-oriented, so it produces object-oriented programming that OO, how to object-oriented how to abstract, how to encapsulate that. Let me use Java to give an example

Two stones grind into a stone knife, how to abstract encapsulation.

1, we can easily see a class of stone, think of a stone inside should have a way to become what. At first I think so, but in a careful think of the wrong, if the stone turned himself into a stone knife, then it is not there, so this method should not be placed in their own, should be in writing a factory class is responsible for the stone into stone knife,

2, all should have two class stone and stonefactory Stone have some of their own properties, and the factory method is responsible for turning the stone into stone knives

3, we are interested can go to see the Zhang Xiaoxiang: object-oriented Design of this session of the video about 20 minutes.


Related Article

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.