$theTitle=wp_title(" - ", false); if($theTitle != "") { ?>
One Stop Computer Science
1 Jan // php the_time('Y') ?>
Introduction
–Some support procedural and data-oriented programming (e.g., Ada 95+ and C++)
–Some support functional program (e.g., CLOS)
–Newer languages do not support other paradigms but use their imperative structures (e.g., Java and C#)
–Some are pure OOP language (e.g., Smalltalk & Ruby)
–Some functional languages support OOP, but they are not discussed in this chapter.
Three major language features:
–Abstract data types (Chapter VIII)
–Inheritance
–Polymorphism
Inheritance
–ADTs are difficult to reuse—always need changes
–All ADTs are independent and at the same level
–A class can hide entities from its clients
–A class can also hide entities for its clients while allowing its subclasses to see them
–The new one overrides the inherited one
–The method in the parent is overriden
Besides inheriting methods as is, a class can modify an inherited method
Object Oriented Concepts
Dynamic Binding
Dynamic Binding Concept
Exclusivity of Objects
–Advantage – elegance and purity
–Disadvantage – slow operations on simple objects
–Advantage – fast operations on simple objects
–Disadvantage – results in a confusing type system (two kinds of entities)
–Advantage – fast operations on simple objects and a relatively small typing system
–Disadvantage – still some confusion because of the two type systems
Nested Classes
–Can the new class be nested inside the class that uses it?
–In some cases, the new class is nested inside a subprogram rather than directly in another class
–Which facilities of the nesting class should be visible to the nested class and vice versa
Dynamic Binding of Methods Calls
–Calls to dynamically bound methods can be connected to the corresponding code thru a pointer in the CIR
–The storage structure is sometimes called virtual method tables (vtable)
–Method calls can be represented as offsets from the beginning of the vtable.
Leave a reply