DIR Return Create A Forum - Home
---------------------------------------------------------
Classic Car NZ Enthusiasts
HTML https://classiccarnz.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: General Discussion
*****************************************************
#Post#: 12--------------------------------------------------
Want to learn more about
DIR By: asim roy
Date: September 14, 2023, 6:14 am
---------------------------------------------------------
Encapsulation refers to data hiding that results in managed
access to data using methods. It is one of the object-oriented
languages that provides the above three functions. Contains
several built-in keywords that can be used to communicate
between parent and child classes. Keyword is one such keyword.
Study courses on. What is the keyword in ? Many times subclasses
need to interact with parent classes and methods. Sometimes
instance variables of the parent class are needed in subclass
instances. In this case you can use the keyword which provides
access to parent class variables and methods using subclass
instances.
Uses in In There are basically three uses for the keyword. These
uses are explained in detail in the next section. Used to access
parent class member variables. Consider a scenario Phone Number
List
HTML https://b2bphonelist.com/
where there is a parent class and a
child class . The parent class has an integer type variable
named . The class also contains a member variable named . If you
access a member of a class you will access an instance of the
class. This can best be explained with the help of an example
Popular Classes Consider a parent class with the following class
definition public class shape public area.
[img]
HTML https://github.com/mdsakib0012/image/blob/main/phone%20number.png?raw=true[/img]
HTML https://b2bphonelist.com/
A class that extends a class looks like this public class
extends public area public return area Now if from class
instance calls the method the returned area will be the value of
the area instance of the class. However the parent class also
has as a member variable. The following code snippet
demonstrates this System. Output The above code will display on
the console screen which is the area of the subclass . But what
if you need the area of the parent class? How can I get the
value of this region instance? The subclass also contains an
instance member with the same name. In this case the keyword
needs to be used.
*****************************************************
Page 1 of 1