TAILIEUCHUNG - Lecture Object oriented programming - Lecture no 03

In the previous two chapters, you learned about technologies that software engineers need to master before developing applications. Now, we can start thinking about the particular problem we wish to solve. We will first put effort into understanding the background of the problem, a process called domain analysis. Then we will look at the information you have to gather so that you can describe the problem and its proposed solution. Finally, we will discuss some techniques for gathering and analyzing that information. | CSC241: Object Oriented Programming Lecture No 03 Previous Lecture Simple C++ program using cin and cout Member function with parameters GradeBook class Book class Distance class Set functions and get functions A little about Constructor Today’s Lecture Constructor – example program Placing class in separate file Destructor – example program Constructor with arguments – example program Example program – Distance class Data members Feet Inches Member functions void setdist(int ft, float in); void getdist(); void initialize(); void showdist(); Go to program Distance class – data member initialization Distance class shows two ways to initialize the data items in an object void initialize(); void setdist(int ft, float in); Can an object be initialized whenever it is created, without requiring a separate call to a member function? Automatic initialization is carried out using a special member function called a constructor. A constructor is a member function that is executed automatically .

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.