1 / 9

Teksi Kereta bapa

Teksi Kereta bapa. 5.25 ACCESS SPECIFIERS. Definition : Access specifiers are used to limit access to the class members. private. protected. public. OBJEKTIF. Di akhir pengajaran ini :

feivel
Télécharger la présentation

Teksi Kereta bapa

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Teksi Kereta bapa

  2. 5.25 ACCESS SPECIFIERS Definition : Access specifiers are used to limit access to the class members. private protected public

  3. OBJEKTIF Di akhirpengajaranini : Pelajardapatmenerangkanmaksudpublic access specifierssecarabertulismenggunakanperkataansendiridenganbetul. Pelajardapatmenerangkanmaksudprivate access specifierssecarabertulismenggunakanperkataansendiridenganbetul. 3) Pelajardapatmenerangkanempatciri-ciriconstructorsecaralisanmenggunakanperkataansendiridenganbetul.

  4. (A) PUBLIC ACCESS SPECIFIERS Specified using the keyword public. This keyword specifies that the class members are accessible outside the class definition. The members under this access specifier are called public class members.

  5. (A) PUBLIC ACCESS SPECIFIERS Public access specifier Example: class Rectangle { public : float l,w,a; void accept(); void area(); void display(); }; Code segment 5.2.7 Members under public access specifier are called public class members.

  6. (A) PUBLIC ACCESS SPECIFIERS Syntax: class <class name> { public : <variable declaration>; <function declaration>; };

  7. (B) PRIVATE ACCESS SPECIFIERS Specified using the keyword private. This keyword specifies that the class members are not accessible outside the class definition. The members under this access specifier are called private class members.

  8. (B) PRIVATE ACCESS SPECIFIERS Example: class Rectangle { private : float l,w,a; public : void accept(); void area(); void display(); }; Code segment 5.2.8 Private Access Specifier Private class member

  9. (B) PRIVATE ACCESS SPECIFIERS Syntax: class <class name> { private : <variable declaration>; <function declaration>; };

More Related