Class Inheritance - E-Commerce - Lecture Slides, Slides of Fundamentals of E-Commerce

Students of Communication, study E-Commerce as an auxiliary subject. these are the key points discussed in these Lecture Slides of E-Commerce : Class Inheritance, Specific Hierarchy, General Representation, Attributes, Child Class, Parent, Redefined Attributes, Superclass, Parent Class, Singular Inheritance

Typology: Slides

2012/2013

Uploaded on 07/29/2013

sheil_34
sheil_34 🇮🇳

4.4

(14)

129 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Enterprise Programming
INTERMEDIATE ABAP
OBJECTS
Class Inheritance
Inheritance allows grouping of similar classes in
a general-to-specific hierarchy.
The parent class is a general representation
and contains those attributes and methods
common to the 'family.'
The child class(es) is/are a more specific
instance of the parent with added or
redefined attributes and/or methods.
Often described as a "is a" relationship.
Parent class = superclass
Child class = subclass
Parent Class
Child Classes
Docsity.com
pf3
pf4
pf5
pf8

Partial preview of the text

Download Class Inheritance - E-Commerce - Lecture Slides and more Slides Fundamentals of E-Commerce in PDF only on Docsity!

Enterprise Programming

INTERMEDIATE ABAP

OBJECTS

Class Inheritance

Inheritance allows grouping of similar classes in a general-to-specific hierarchy. The parent class is a general representation and contains those attributes and methods common to the 'family.' The child class(es) is/are a more specific instance of the parent with added or redefined attributes and/or methods. Often described as a "is a" relationship.

Parent class = superclass

Child class = subclass

Parent Class

Child Classes

Docsity.com

Class Inheritance Example

document

  • doc_number
  • date
  • doc_type +get_doc_number +set_doc_number … +display_doc

po_document

  • vendor_id
  • company_code
  • delivery_date +get_vendor_id +set_vendor_id …

sales_document

  • customer_id
  • company_code
  • fulfill_by_date +get_customer_id +set_customer_id …

Class inheritance principles

Common attributes and methods are defined in the superclass.

Items defined in the superclass are inherited in the subclass(es) and considered to be a part of their definition. Avoids redundant definition. Promotes "programming by difference"—subclass only defines those things that are different.

ABAP supports only singular inheritance, so a subclass can have only one parent superclass.

In comparing the superclass and the subclass, which is the more specific class?

Docsity.com

Let's Practice

Let's Practice

Docsity.com

Inherited element visibility

A private component (attribute or method) of a superclass cannot be referenced by the subclass. These elements can only be accessed if made available by the superclass through public methods. This is done to ensure security of data.

Attributes and methods can be designated as PROTECTED.

PROTECTED resources are defined in the PROTECTED SECTION of a class definition. Protected resources are visible within the class and its children. Similar to saying something is public to a class and its descendants, but private to everyone else.

In the definition of an Object, the sections must appear in the order: PUBLIC SECTION, PROTECTED SECTION, and PRIVATE SECTION.

Static elements

A class shares static attributes with its children in the same fashion as other attributes.

A class shares static methods with its children, but those methods cannot be redefined.

Docsity.com

Narrowing, Widening Summary

Document Reference

P.O. Document Reference

Document Object

P.O. Document Object

Document Reference

P.O. Document Object

Narrowing Cast

P.O. Document Reference

Document

= Object

Widening Cast

When Document Reference is used to refer to this object, can only use methods and attributes defined for Documents. I lose some abilities. (Have narrower ability.)

When P.O. Document Reference is used to refer to this object, I can use methods and attributes defined for P.O. Documents. (Have wider ability.) However, this is only valid if the object I'm assigned is actually a P.O Document formerly cast using a Narrowing Cast.

Let's Practice

Docsity.com

Let's Practice

Class Builder

Just as TYPES creates local data types, so too does CLASS define local classes. We must use the ABAP Dictionary to define classes that are reusable across programs.

The Class Builder (SE24) is a special maintenance tool that allows the creation of global classes within the ABAP Dictionary. Start the Class Builder and supply the name of the class to be created (respecting the namespace). Specify "Usual ABAP Class". Remove "Final" as it means the Class will not be able to be extended to subclasses. Use Attributes tab to specify Attributes. Use Methods tab to specify Methods. Button for constructor and parameters Double click to define method behavior.

Docsity.com