C++ General Characteristics: - Mixed typing system - Constructors and destructors - Elaborate access controls to class entities.

Slides:



Advertisements
Similar presentations
Object-Oriented Programming Session 9 Course : T Programming Language Concept Year : February 2011.
Advertisements

Software Productivity
Chapter 12 Support for Object-Oriented Programming.
Chapter 12: Support for Object-Oriented Programming
Object-Oriented Programming CS 3360 Spring 2012 Sec , Adapted from Addison Wesley’s lecture notes (Copyright © 2004 Pearson Addison.
Advanced Programming in Java
Sadegh Aliakbary Sharif University of Technology Fall 2010.
ISBN Chapter 12 Support for Object-Oriented Programming.
Abstract Data Types and Encapsulation Concepts
1 Chapter 12 © 2002 by Addison Wesley Longman, Inc Introduction - Categories of languages that support OOP: 1. OOP support is added to an existing.
8.1 Classes & Inheritance Inheritance Objects are created to model ‘things’ Sometimes, ‘things’ may be different, but still have many attributes.
ISBN Chapter 12 Support for Object- Oriented Programming.
CS 355 – PROGRAMMING LANGUAGES Dr. X. Copyright © 2012 Addison-Wesley. All rights reserved.1-2 Chapter 12 Topics Introduction Object-Oriented Programming.
Support for Object-Oriented Programming
Chapter 12 Support for Object-Oriented Programming.
CPS 506 Comparative Programming Languages
(11.1) COEN Data Abstraction and OOP  Data Abstraction – Problems with subprogram abstraction – Encapsulation – Data abstraction – Language issues.
1 Chapter 11 Abstract Data Types and Encapsulation Constructs.
ISBN Chapter 12 Support for Object-Oriented Programming.
OOPs Object oriented programming. Based on ADT principles  Representation of type and operations in a single unit  Available for other units to create.
Object Oriented Programming: Java Edition By: Samuel Robinson.
Object-Oriented Programming Session 9 Course : T Programming Language Concept Year : February 2011.
CSE 425: Object-Oriented Programming I Object-Oriented Programming A design method as well as a programming paradigm –For example, CRC cards, noun-verb.
Inheritance in the Java programming language J. W. Rider.
Introduction to Object Oriented Programming CMSC 331.
More on Hierarchies 1. When an object of a subclass is instantiated, is memory allocated for only the data members of the subclass or also for the members.
Chapter 12 Support for Object-Oriented Programming.
Chapter 12 Support for Object-Oriented Programming.
ISBN Chapter 12 Support for Object-Oriented Programming.
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
Lecture 10 Concepts of Programming Languages Arne Kutzner Hanyang University / Seoul Korea.
Chapter 12 Support for Object-Oriented Programming.
Object-Oriented Programming Chapter Chapter
(1) ICS 313: Programming Language Theory Chapter 12: Object Oriented Programming.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
1 Copyright © 1998 by Addison Wesley Longman, Inc. Chapter 11 Categories of languages that support OOP: 1. OOP support is added to an existing language.
ISBN Object-Oriented Programming Chapter Chapter
1 Chapter 11 © 1998 by Addison Wesley Longman, Inc The Concept of Abstraction - The concept of abstraction is fundamental in programming - Nearly.
1 CS Programming Languages Class 22 November 14, 2000.
1 Copyright © 1998 by Addison Wesley Longman, Inc. Chapter 10 Abstraction - The concept of abstraction is fundamental in programming - Nearly all programming.
YG - CS Concept of Encapsulation What is encapsulation? - data and functions/methods are packaged together in the class normally.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
ISBN Chapter 12 Support for Object-Oriented Programming.
Chapter 12: Support for Object- Oriented Programming Lecture # 18.
Geoff Holmes and Bernhard Pfahringer COMP206-08S General Programming 2.
Object-Oriented Design
Advanced Programming in Java
Advanced Programming in Java
12.1 Introduction - Categories of languages that support OOP:
Support for Object-Oriented Programming
Support for Object-Oriented Programming
11.1 The Concept of Abstraction
Support for Object-Oriented Programming
Support for Object-Oriented Programming in Ada 95
Object-Oriented Programming
More Object-Oriented Programming
Advanced Programming in Java
Support for Object-Oriented Programming
Advanced Programming in Java
Support for Object-Oriented Programming
Object-Oriented Programming
Support for Object-Oriented Programming
Support for Object-Oriented Programming
Lecture 10 Concepts of Programming Languages
Chapter 12 Categories of languages that support OOP:
11.1 The Concept of Abstraction
Chapter 11 Abstraction - The concept of abstraction is fundamental in
Presentation transcript:

C++ General Characteristics: - Mixed typing system - Constructors and destructors - Elaborate access controls to class entities

C++ Inheritance - A class need not be subclasses of any class - Access controls for members are 1. Private (visible only in the class and friends) 2. Public (visible in subclasses and clients) 3. Protected (visible in the class and in subclasses) - In addition, the subclassing process can be declared with access controls, which define potential changes in access by subclasses - Multiple inheritance is supported

C++ Inheritance (2) Dynamic Binding - A method can be defined to be virtual, which means that they can be called through polymorphic variables and dynamically bound to messages. - A pure virtual function has no definition at all. - A class that has at least one pure virtual function is an abstract class.

C++ Evaluation C++ provides extensive access control (unlike Smalltalk) C++ provides multiple inheritance In C++, the programmer must decide at design time which methods will be statically bound and which must be dynamically bound Static binding is faster! Smalltalk type checking is dynamic (flexible, but somewhat unsafe)

Java General Characteristics - All data are objects except the primitive types - All primitive types have wrapper classes that store one data value - All objects are heap-dynamic, are referenced through reference variables, and most are allocated with new

Java Inheritance Single inheritance only, but there is an abstract class category that provides some of the benefits of multiple inheritance (interface) An interface can include only method declarations and named constants e.g., public class Clock extends Applet implements Runnable Methods can be final (cannot be overriden)

Dynamic Binding in Java - In Java, all messages are dynamically bound to methods, unless the method is final

Encapsulation in Java Two constructs, classes and packages Packages provide a container for classes that are related. Entities defined without an scope (access) modifier have package scope, which makes them visible throughout the package in which they are defined. Every class in a package is a friend to the package scope entities elsewhere in the package.