Information Technology > Research Paper > MANCOSA (Pty) Ltd - Claremont - INFORMATIC 1Informatics 1b ass2 raw (All)
1-Encapsulation It means encapsulation, and it is a method that can be followed to hide the basic data in the class, that is, to hide the features in it (Global Variables), and to make other classes... able to deal with these properties only through functions that are created by the main programmer for the class. The method used in the encapsulation process Since the basic idea of encapsulation is to hide the data on the one hand and allow it to be dealt with on the other hand. The first thing that you have to think about is that all the properties (that is, the variables that will save the data) in the class must be defined as private because defining the properties as private means that they can only be accessed from within the class in which they are located. The second thing you should think about is finding a way to access these characteristics from outside. Therefore, you must prepare public functions to deal with these properties, because public functions can be accessed from anywhere. So to achieve the principle of encapsulation, you have to define properties as private and the functions used to access them as public. 2-Inheritance It is the transfer of traits from one person to another, and this process is called inheritance. Genetics in programming is the transfer of a group of specialists and functions from the inherited class to the inherited class called superclass. The heir with the subclass. There are other names for the inherited class, which are the parent class and base class. The inheritor class has the child class and the derived class . When we perform the inheritance process between two classes, the inheriting class becomes of the type of class inherited, and the inheriting class can use the set of objects and functions in the parent class. Keyword extends: The keyword extends is used to inherit the class properties of the class to be inherited from. An example of how to inherit public class parent { private String Name; public void SetName (String name) { this.Name = name; } public String GetName () { return this.Name; } [Show More]
Last updated: 1 year ago
Preview 1 out of 3 pages
Instant download
Instant download
MANCOSA (Pty) Ltd - Claremont - INFORMATIC
By Muchiri 3 years ago
$29
10
Connected school, study & course
About the document
Uploaded On
Apr 21, 2021
Number of pages
3
Written in
This document has been written for:
Uploaded
Apr 21, 2021
Downloads
0
Views
43
In Browsegrades, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Browsegrades · High quality services·