OOP Abstraction Classes Class Members: Properties & Methods Instance (object) Encapsulation Interfaces Inheritance Composition Polymorphism Using Inheritance.

Slides:



Advertisements
Similar presentations
ITF11006.NET Inheritance. Classes and Inheritance Constructors and Inheritance Modifiers Interfaces Operators.
Advertisements

1 Chapter 6: Extending classes and Inheritance. 2 Basics of Inheritance One of the basic objectives of Inheritance is code reuse If you want to extend.
Inheritance Definition Relationships Member Access Control Data Encapsulation Overloading vs. Overriding Constructors & Destructors.
Objectives Introduction to Inheritance and Composition (Subclasses and SuperClasses) Overriding (and extending), and inheriting methods and constructors.
More about classes and objects Classes in Visual Basic.NET.
Interface & Abstract Class. Interface Definition All method in an interface are abstract methods. Methods are declared without the implementation part.
Object-Oriented PHP (1)
Inheritance and Polymorphism CS351 – Programming Paradigms.
Inheritance. Types of Inheritance Implementation inheritance means that a type derives from a base type, taking all the base type’s member fields and.
Object Based Programming. Summary Slide  Instantiating An Object  Encapsulation  Inheritance  Polymorphism –Overriding Methods –Overloading vs. Overriding.
Inheritance using Java
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Taken from slides of Starting Out with C++ Early Objects Seventh Edition.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
Lecture 8 Inheritance Richard Gesick. 2 OBJECTIVES How inheritance promotes software reusability. The concepts of base classes and derived classes. To.
Object Oriented Concepts
Lecture 9 Polymorphism Richard Gesick.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
BIM313 – Advanced Programming Techniques Object-Oriented Programming 1.
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
Inheritance in the Java programming language J. W. Rider.
OOP: Encapsulation,Abstraction & Polymorphism. What is Encapsulation Described as a protective barrier that prevents the code and data being randomly.
Session 04 Module 8: Abstract classes and Interface Module 9: Properties and Indexers.
Module 10: Inheritance in C#. Overview Deriving Classes Implementing Methods Using Sealed Classes Using Interfaces Using Abstract Classes.
C# Classes and Inheritance CNS 3260 C#.NET Software Development.
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
OOPs Object oriented programming. Abstract data types  Representationof type and operations in a single unit  Available for other units to create variables.
Object Oriented Programming
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
Interfaces Chapter 9. 9 Creating Interfaces An interface is a contract. Every class that implements the interface must provide the interface’s defined.
Application development with Java Lecture 21. Inheritance Subclasses Overriding Object class.
Introduction to Object-Oriented Programming Lesson 2.
CSCI 3328 Object Oriented Programming in C# Chapter 9: Classes and Objects: A Deeper Look – Exercises 1 Xiang Lian The University of Texas Rio Grande Valley.
Basic Concepts of OOP.  Object-Oriented Programming (OOP) is a type of programming added to php5 that makes building complex, modular and reusable web.
Presented by Ted Higgins, SQL Server DBA An Introduction to Object – Oriented Programming.
1 C# - Inheritance and Polymorphism. 2 1.Inheritance 2.Implementing Inheritance in C# 3.Constructor calls in Inheritance 4.Protected Access Modifier 5.The.
COP INTERMEDIATE JAVA Inheritance, Polymorphism, Interfaces.
 2006 Pearson Education, Inc. All rights reserved Object-Oriented Programming: Polymorphism.
1 Inheritance One of the goals of object oriented programming is code reuse. Inheritance is one mechanism for accomplishing code reuse. It allows us to.
C#.Net Software Development Version 1.0. Overview Inheritance Member Access Constructors Polymorphism (Name Hiding) Multilevel Hierarchy Virtual and VTable.
Java Programming: Guided Learning with Early Objects Chapter 9 Inheritance and Polymorphism.
These materials where developed by Martin Schray
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
OOP: Encapsulation &Abstraction
Object-Oriented Programming Concepts
Classes and Inheritance
Final and Abstract Classes
Inheritance and Polymorphism
One class is an extension of another.
Microsoft Visual Basic 2005: Reloaded Second Edition
Inheritance Modern object-oriented (OO) programming languages provide 3 capabilities: encapsulation inheritance polymorphism which can improve the design,
Chapter 10 Thinking in Objects
Module 4: Implementing Object-Oriented Programming Techniques in C#
OOP’S Concepts in C#.Net
Conditional Statements
Object-Oriented Programming
Abstract Classes AKEEL AHMED.
Interfaces.
Advanced Java Programming
Java Inheritance.
Fundaments of Game Design
Understanding Polymorphism
Object-Oriented Programming
CIS 199 Final Review.
Final and Abstract Classes
Chapter 11 Inheritance and Encapsulation and Polymorphism
The Object Paradigm Classes – Templates for creating objects
មជ្ឈមណ្ឌលកូរ៉េ សហ្វវែរ អេច អ ឌី
C++ Object Oriented 1.
Presentation transcript:

OOP Abstraction Classes Class Members: Properties & Methods Instance (object) Encapsulation Interfaces Inheritance Composition Polymorphism Using Inheritance Using Interfaces

Abstraction A model of the properties, actions, and interactions of real world objects that are required for a software application.

Classes A class is a template for an object. The class defines the properties (data attributes) and methods (functions in a class) that will be common to all instances of that class (objects) created from it.

Encapsulation Functional details (how a member is implemented) of one object are hidden from objects that interact with it.

Classes & Interfaces An Interface is a logical group of properties & methods that can be implemented by a class All Interface members are implicitly public There is no code inside interface members. Can’t be static, virtual, abstract, or sealed

Interfaces & ArcGIS Once published, Interfaces should not be modified (add/remove members) (e.g. IBasicMap, IBasicMap2)

Inheritance Some classes have some things in common The common things can be promoted to a base class The specific things can remain in the derived classes

Inheritance syntax and keywords MyClass : BaseClass MyClass inherits from BaseClass, e.g.: class Cow : Animal abstract keyword Class cannot be instantiated only derived from, e.g.: public abstract class Animal sealed keyword Class cannot be derived from, e.g.: public sealed class Cow

Inheritance syntax and keywords virtual & override keywords Base class virtual members can be overridden in derived classes

Inheritance syntax and keywords protected keyword Member is accessible to base class and derived classes NOT to external classes

Inheritance syntax and keywords base keyword Call members on base class

Scope Review public internal (default) protected private Entire solution Assembly only Derived classes Class only More …

Inheritance and casting Casting = converting between types implicit explicit Can also cast between interfaces on Same class Base and derived classes

Abstract Classes vs Interfaces Similarities Can be Inherited SomeClass : BaseClass ISomeInterface : ISomeOtherInterface Declared as variable types BaseClass bc; ISomeInterface si; Cannot be instantiated new BaseClass() new ISomeInterface()

Abstract Classes vs Interfaces Differences Abstract ClassesInterfaces Inherit from one parent One or more interfaces can be implemented on one or more classes Abstract and non-abstract membersMembers have no implementation Members can be public, private, protected, internal, protected internal Only public members

Composition One class composed of another MapLayerFeatureLayerRasterLayer * No direct access to Udder via Cow Composition can be setup to allow access to members of dependent classes. Composition in ArcGIS

Polymorphism (Using Inheritance) Polymorphism: Members that have the same name but different implementations in different objects Polymorphism using inheritance: Members in derived classes have same name but different implementations than the base class.

Polymorphism (Using Interfaces) Implementation of interface can be different in classes that implement it

OOP Abstraction Classes Class Members: Properties & Methods Instance (object) Encapsulation Interfaces Inheritance Composition Polymorphism Using Inheritance Using Interfaces