Posts

Abstract Class

Image
        Introduction:    We will cover the following basic concepts: Basics of Abstract Class . Example Class to understand practical implications . Example program to implement the methods of the class . Why Abstract Class? Lets Start 1. First let us compare Normal Class and Abstract Class. Below comparison will give us a basic understanding of an abstract class . 2. Let us create an Abstract Class example to understand the practical implications. Create an Abstract Class as shown below. LINE 3: To make a class abstract class we need to add the keyword ABSTRACT  in the definition section. LINE 6:Let us define an abstract method using the same keyword as above. METHODS :ABSTRACT_METHOD ABSTRACT . LINE7: Define a non-abstract method. METHODS : NORMAL_METHOD. LINE8:Lets try to define a static abstract method. CLASS-METHODS : STATIC_ABSTRACT_METHOD ABSTRACT . Interestingly, we cannot define a static method as an abstract method. This is because stat...

Friend Class Indeed

Image
      Introduction:    We will cover the following basic concepts: Understand the basics of Friend Class. Create an example to understand the working of a friend class. Create a program to run the methods of the example classes. Why do we need a Friend Class? Lets Start 1. First let us understand theoretically the working of the friend class from the below comparison. Let us compare CLASS INHERITANCE and FRIEND CLASS to understand the basics of friendship. Comparison Table 2. Let us create an example to demonstrate the working of the Friend Class. Let us first create a Global Interface . Define a Static Attribute IV_INTERFACE_ATTR. Define a Method named METHOD. Save, Check & Activate. Let us create a HANA Eclipse Class 'ZCLASS_FRIEND' -> class granting the friendship. Here we will add the Created Interface 'ZGLOBAL_INTERFACE' in the PUBLIC SECTION . Create the Method 'PRIVATE_FRIEND_METHOD' in the class's PRIVATE SECTION . This class will grant fr...

Class Inheritance

Image
    Introduction:    We will cover the following basic concepts: Understand the basics of Class Inheritance. Simple example class to understand how we can work with Class Inheritance in different scenarios. We will see the use of SUPER and ME keywords in the context of Inheritance. Create a program to demonstrate the different ways to call methods using Inheritance. Why Class Inheritance? Lets Start 1. Let us create the below comparison chart to understand the basics of  CLASS INHERITANCE. Basic Inheritance Tree Inheritance Basic Comparison Table 2. Lets us create a simple eclipse class and make it work for different scenarios. We will add one method in each visibility section of the Eclipse Class as shown below. PUBLIC_METHOD, PROTECTED_METHOD, and PRIVATE METHOD. Now let us create the implementations for the created methods. Here we have created a FINAL CLASS ( i.e. add the FINAL keyword in the definition section of the class) just to see what happens if we ...

Special Method: Constructor

Image
  Introduction:    We will cover the following basic concepts: Understand, what are constructors. Simple example class, specially designed to understand the basics of Constructors. Create a program to demonstrate different ways constructors behave. Why Constructors? 1. So, what are constructors? Let us understand the basics of the constructors by studying simple differences between normal methods and constructors. 2. Let us start our example by creating a HANA Eclipse class with the below structure. We will create the below 4 methods in the visibility  PUBLIC SECTION of the CLASS DEFINITION . Create a Special Instance Method Constructor with the name CONSTRUCTOR, this is the default name we use to create an instance constructor. We will also create a Normal Instance Method with the name INSTANCE_METHOD. Create a Special Static Method Constructor with the name CLASS_CONSTRUCTOR, this is the default name we use to create a static constructor. And similarly we will ...

Class Visibility

Image
  Introduction:    We will cover the following basic concepts: Simple example class, specially designed to understand the basics of Class Visibility. How visibility of the class components like attributes and methods work. How can a developer utilize the visibility property to his advantage ?.   Use of 'Me' variable Demonstration of visibility in an executable eclipse program. Why use Visibility?   Lets Start : 1. Let us create a class in HANA Eclipse with the following structure. We will define the below components in the class definition. PUBLIC SECTION : This means the class components like Attributes and Methods defined in this section are visible outside the  Class, in Sub-Classes, in an Executable Program. We will create Attribute:  CV_PUBLIC_ATTR with default value 'PUBLIC SECTION'. We will create Method: CM_PUBLIC_METHOD,CM_PUBLIC_MAIN_METHOD. PROTECTED SECTION : This ...