TAILIEUCHUNG - C++ For Dummies 5th Edition phần 5

Nếu bạn đang ở trên các điều kiện thân thiện với toán học (hey, không phải tất cả chúng ta?), Bạn có thể nghĩ đến một biến trong toán học như một hộp vô định hình có khả năng giữ những gì đã bao giờ bạn có thể chọn để lưu trữ trong nó. Bạn có thể dễ dàng viết một cái gì đó giống như | 160 Part III Introduction to Classes_ I don t have to clutter my limited storage with all the things that an SUV has in common with other cars. All I have to remember is an SUV is a car that . . . and tack on those few things that are unique to an SUV like the price tag . I can go further. Cars are a subclass of wheeled vehicles along with other members such as trucks and pickups. Maybe wheeled vehicles are a subclass of vehicles which includes boats and planes. And on and on and on. Why Classify Why do we classify It sounds like a lot of trouble. Besides people have been using the functional approach for so long why change now It may seem easier to design and build a microwave oven specifically for this one problem rather than build a separate more generic oven object. Suppose for example that I want to build a microwave to cook nachos and nachos only. I wouldn t need to put a front panel on it other than a START button. I always cook nachos the same amount of time so I could dispense with all that DEFROST and TEMP COOK nonsense. My nachos-only microwave needs to hold only one flat little plate. Three cubic feet of space would be wasted on nachos. For that matter I can dispense with the concept of microwave oven altogether. All I really need is the guts of the oven. Then in the recipe I put the instructions to make it work Put nachos in the box. Connect the red wire to the black wire. Bring the radar tube up to about 3 000 volts. Notice a slight hum. Try not to stand too close if you intend to have children. Stuff like that. But the functional approach has some problems Too complex. I don t want the details of oven building mixed into the details of nacho building. If I can t define the objects and pull them out of the morass of details to deal with separately I must deal with all the complexities of the problem at the same time. Not flexible. Someday I may need to replace the microwave oven with some other .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.