Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
Lecture Object oriented programming - Lecture no 15
Đang chuẩn bị liên kết để tải về tài liệu:
Lecture Object oriented programming - Lecture no 15
Lan Vy
110
19
pptx
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
In this chapter we will cover another group of control statements called repetition statements. Repetition statements control a block of code to be executed for a fixed number of times or until a certain condition is met. We will describe Java’s three repetition statements: while, do–while, and for. | CSC241: Object Oriented Programming Lecture No 15 Previous Lecture Function overriding Example program Stack class – stack2 class push() and pop() Distance class – Distsign class getdist() and setdist() Class hierarchy Employee program Employee class Scientist class Manager class Laberor class Today’s Lecture Abstract class Public and private Inheritance Example program Level of inheritance Abstract base class Classes used only for deriving other classes, as employee, are sometimes loosely called abstract classes, meaning that no actual instances (objects) of this class are created public and private Inheritance Class manager : public employee The keyword public specifies that objects of the derived class are able to access public member functions of the base class When this keyword is not used, objects of the derived class cannot access public member functions of the base class Result is that no member of the base class is accessible to objects of the derived class Cont. public . | CSC241: Object Oriented Programming Lecture No 15 Previous Lecture Function overriding Example program Stack class – stack2 class push() and pop() Distance class – Distsign class getdist() and setdist() Class hierarchy Employee program Employee class Scientist class Manager class Laberor class Today’s Lecture Abstract class Public and private Inheritance Example program Level of inheritance Abstract base class Classes used only for deriving other classes, as employee, are sometimes loosely called abstract classes, meaning that no actual instances (objects) of this class are created public and private Inheritance Class manager : public employee The keyword public specifies that objects of the derived class are able to access public member functions of the base class When this keyword is not used, objects of the derived class cannot access public member functions of the base class Result is that no member of the base class is accessible to objects of the derived class Cont. public inheritance represents is a relationship Base class : access specifier Type of inheritance Public inheritance Protected inheritance Private inheritance Public Public in derived class Protected in derived class Private in derived class Protected Protected in derived class Protected in derived class Private in derived class Private Hidden in derived class Hidden in derived class hidden in derived class Access Combinations class A { private: int privdataA; protected: int protdataA; public: int pubdataA; }; int z; B objB; z = objB.privdataA; z = objB.protdataA; z = objB.pubdataA; class B : public A { public: void access() { int x; x = privdataA; x = protdataA; x = pubdataA; } }; class C : private A { public: void access() { int y; y = privdataA; y = protdataA; y = pubdataA; } }; z = objC.privdataA; z = objC.protdataA; z = objC.pubdataA; Go to program Cont. Derived class Functions can access protected and public member in base class (in case of public, protected and private inheritance) Objects
TÀI LIỆU LIÊN QUAN
Lecture Object oriented programming - Lecture No 04
Lecture Object oriented programming - Lecture No 05
Lecture Object oriented programming - Lecture No 03
Lecture Object oriented programming - Lecture no 09
Lecture Object oriented programming - Lecture no 10
Lecture Object oriented programming - Lecture no 11
Lecture Object oriented programming - Lecture no 12
Lecture Object oriented programming - Lecture no 13
Lecture Object oriented programming - Lecture no 14
Lecture Object oriented programming - Lecture no 15
crossorigin="anonymous">
Đã 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.