1. Trang chủ
  2. » Địa lý

Lập trình hướng đối tượng: Session 4 - Class Basics

7 15 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 7
Dung lượng 66,72 KB

Nội dung

• Upon creation, each element, starting from the first, calls the no-arguments. constructor for itself[r]

(1)(2)

Objectives

Class Basics

– Classes – UML

– Privacy

– Constructors – Destructors

(3)

Class Basics

• A class is a derived data type the

members of which are private by default • Classes are much more common in

object-oriented programming than

(4)

CLASSES

• The keyword class identifies a class

class Student {

int no; char grade[14]; public:

(5)

Instance of a Class(1)

• An instance of a class is called object • The declaration of an instance allocates

memory for the object

• The form of an instance declaration is

Identifier instance;

– Identifier is the name of the class

(6)

ARRAYS OF OBJECTS

• An array of objects occupies contiguous memory

• Upon creation, each element, starting from the first, calls the no-arguments

constructor for itself

• Upon destruction, each element, starting from the last element created and

(7)

Summary

Class Basics

– Classes – UML

– Privacy

– Constructors – Destructors

– Arrays of Objects

Ngày đăng: 10/03/2021, 14:34

w