OOP Languages (Java vs C++)

OOP Languages: Java vs C++

Program Structure

Class definition similar in Java and C++
Java: two types of programs
application (with main() function)
applet (typically embedded in a web page)
C++
a program is (still) a collection of functions that may use objects and classes
main() function serves as driver

PROGRAM EXECUTION
Java: Virtual Machine (VM)
programs: both compiled and interpreted
compiler produces .class from .java
VM loads .class file(s) as needed
C++: compiled, linked, and loaded
modules separately compiled
linked to produce executable
static vs dynamic libraries

ENCAPSULATION
Enforced through access keywords
public: for interface
private: to make implementation inaccessible
protected: access for subclasses only
In Java
each member is prefixed with a keyword
another access level: package-access
In C++
public, private, and protected sections
friend keyword used to break encapsulation

OBJECTS AND IDENTITY
Questions:
How/when are objects created?
What is the relationship between a variable and an object?
Difference between Java and C++
distinction between primitive (built-in) type variables and variables for objects
reference relationship between variable and actual object

GUI PROGRAMMING
In Java, GUI is part of its development kit
java.awt.* is a collection of classes that support visual programming and graphics
visual objects (buttons, text fields, etc), layout managers, events, etc.
In C++
not part of the language
libraries dependent on platform (e.g., MFCs and Motif)

Cours gratuitTélécharger le cours complet

Télécharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *