IEG 3080 Tutorial 2 Jack Chan. Prepared by Jack Chan, Spring 2007 Outline.Net Platform Object Oriented Concepts Encapsulation Inheritance Polymorphism.

Slides:



Advertisements
Similar presentations
1 l Inheritance Basics l Programming with Inheritance l Dynamic Binding and Polymorphism Inheritance.
Advertisements

OBJECT ORIENTED PROGRAMMING M Taimoor Khan
Inheritance Inheritance Reserved word protected Reserved word super
Section 5 – Classes. Object-Oriented Language Features Abstraction –Abstract or identify the objects involved in the problem Encapsulation –Packaging.
IEG3080 Tutorial 3 Prepared by Ryan. Outline Object Oriented Programming Concepts Encapsulation Inheritance Polymorphism Delegation Course Project.
Liang,Introduction to Java Programming,revised by Dai-kaiyu 1 Chapter 10 Object-Oriented Modeling.
1 CS1001 Lecture Overview Homework 3 Homework 3 Project/Paper Project/Paper Object Oriented Design Object Oriented Design.
1 Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 8.1 – 8.5.
Object Oriented System Development with VB .NET
Introduction to the C# Programming Language for the VB Programmer.
1 Chapter 7 l Inheritance Basics l Programming with Inheritance l Dynamic Binding and Polymorphism Inheritance.
Advanced Object-Oriented Programming Features
1 Object-Oriented Design. 2 Objectives F To become familiar with the process of program development. F To the relationship types: association, aggregation,
Chapter 7 - Generalization/Specialization and Inheritance1 Chapter 7 Generalization/Specialization and Inheritance.
Microsoft Visual Basic 2012 CHAPTER ONE Introduction to Visual Basic 2012 Programming.
Microsoft Visual Basic 2005 CHAPTER 1 Introduction to Visual Basic 2005 Programming.
Introduction 01_intro.ppt
Abstraction, Inheritance, and Polymorphism in Java.
CSCI 3327 Visual Basic Chapter 1: Introduction to Visual Basic
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.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
Object Oriented Design and Programming Alan Goude Room: Sheaf 9323.
Why Java? A brief introduction to Java and its features Prepared by Mithat Konar.
ISYS 573 Special Topic – VB.Net David Chao. The History of VB Early 1960s:BASIC-Beginner’s All-Purpose Symbolic Instruction Code –Teaching –Simple syntax,
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
Features of Object Oriented Programming Lec.4. ABSTRACTION AND ENCAPSULATION Computer programs can be very complex, perhaps the most complicated artifact.
Object-Oriented Programming (OOP) CSC-2071 (3+1=4 Credits) Lecture No. 1 MBY.
1 Classes and Controls CE-105 Spring 2007 By: Engr. Faisal ur Rehman.
CS212: Object Oriented Analysis and Design Lecture 15: Inheritance in C++ -II.
OOP Class Lawrence D’Antonio Lecture 3 An Overview of C++
Encapsulation, Inheritance & Polymorphism. OOP Properties Encapsulation ­The process of creating programs so that information within a class is not accessible.
CIS 3301 C# Lesson 7 Introduction to Classes. CIS 3302 Objectives Implement Constructors. Know the difference between instance and static members. Understand.
Programming using C# for Teachers Introduction to Objects Reference Types Functions of Classes Attributes and Types to a class LECTURE 2.
Object Oriented Software Development
C# Programming: From Problem Analysis to Program Design1 10 Advanced Object-Oriented Programming Features C# Programming: From Problem Analysis to Program.
Review Class Inheritance, Abstract, Interfaces, Polymorphism, GUI (MVC)
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 11 Object-Oriented.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Object-Oriented Design.
Lesson 1 1 LESSON 1 l Background information l Introduction to Java Introduction and a Taste of Java.
Class Inheritance SWE 344 Internet Protocols & Client Server Programming.
 Description of Inheritance  Base Class Object  Subclass, Subtype, and Substitutability  Forms of Inheritance  Modifiers and Inheritance  The Benefits.
Section 3: Component/Object Oriented Programming, Events, and Delegates in.NET Jim Fiddelke, Greenbrier & Russel.
Object means a real word entity such as pen, chair, table etc. Object-Oriented Programming is a methodology or paradigm to design a program using classes.
Software Construction Lab 05 Abstraction, Inheritance, and Polymorphism in Java.
Chapter 12: Support for Object- Oriented Programming Lecture # 18.
CIS 234: Object-Oriented Programming with Java
CE-105 Spring 2007 By: Engr. Faisal ur Rehman
Introduction to Visual Basic. NET,. NET Framework and Visual Studio
Introduction to Object-oriented Programming
Object-Oriented Programming Concepts
INF230 Basics in C# Programming
Advanced Object-Oriented Programming Features
Introduction to Visual Basic 2008 Programming
Chapter 11 Object-Oriented Design
Mastering UML with Rational Rose 2002
C# and the .NET Framework
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
Creating and Using Classes
Object Oriented Analysis and Design
The University of Texas Rio Grande Valley
Inheritance Basics Programming with Inheritance
Subprograms and Programmer Defined Data Type
Inherited Classes in Java
Computer Programming with JAVA
CSCI 3328 Object Oriented Programming in C# Chapter 9: Classes and Objects: A Deeper Look UTPA – Fall 2012 This set of slides is revised from lecture.
Object-Oriented Programming
មជ្ឈមណ្ឌលកូរ៉េ សហ្វវែរ អេច អ ឌី
C++ Object Oriented 1.
Presentation transcript:

IEG 3080 Tutorial 2 Jack Chan

Prepared by Jack Chan, Spring 2007 Outline.Net Platform Object Oriented Concepts Encapsulation Inheritance Polymorphism Delegation Something about course project

Prepared by Jack Chan, Spring 2007.Net Platform Class Library ADO.NET GUI XML/SOAP DirectX etc Common Language Runtime (CLR) Common Type System Common Language Spec C#VBC++PerlPythonCobolSmalltalk … Figure extracted from “M. Chang, Lecture Note 1, p.45”

Prepared by Jack Chan, Spring 2007.Net Platform Support a wide range of programming languages With CLR (Common Language Runtime) in the platform, to convert source code to intermediate language (MSIL) (in JAVA, JVM is used)

Prepared by Jack Chan, Spring 2007.Net Platform No DLL hell address reference to library functions are resolved by CLR dynamically (not preset by COM programmer) simplified software distribution Support cross-language inheritance (e.g. a VB class derived from a C# class)

Prepared by Jack Chan, Spring 2007.Net Platform Some disadvantages Take time to compile MSIL Not multi-platform Open source “Mono-project” under development Limitation in flexibility compared with J2EE …

Prepared by Jack Chan, Spring 2007 Object Oriented Concepts - Encapsulation Encapsulation Hide details from outside world Only expose user interface Examples: resistor in electronics, random number generator… Black Box (provide certain Service) InputOutput

Prepared by Jack Chan, Spring 2007 Object Oriented Concepts - Encapsulation Why? the less detailed implementation exposed, the easier it is when you want to change the implementation -> the user would not be affected e.g. USB port can support various devices, even the device which has not been invented yet as long as the interface is not changed, any change in implementation would not affect users

Prepared by Jack Chan, Spring 2007 Object Oriented Concepts - Encapsulation Encapsulation Easy for the maintenance of large program Different components provide different services, have different responsibilities clearly. Easier to extend the functionality of components Important to develop large complex software

Prepared by Jack Chan, Spring 2007 Object Oriented Concepts - Encapsulation Encapsulation concept in C# -> visibility public private protected internal protected internal Attributes are usually private Methods could be private or public

Prepared by Jack Chan, Spring 2007 Object Oriented Concepts - Inheritance Inheritance Objects have similar properties -> may belong to a more general object e.g. catdogsparroweagleMammalBirdAnimals with Backbone

Prepared by Jack Chan, Spring 2007 Object Oriented Concepts - Inheritance Why? Make better reuse of existing classes Better structured Use less code e.g. class Mammal { has 4 limbs has fur warm blood…} class Cat : Mammal{ meow } class Dog : Mammal{ bark } class Kitten : Cat{...}

Prepared by Jack Chan, Spring 2007 Object Oriented Concepts - Inheritance Inheritance in C# public class ChildClass : ParentClass { public ChildClass() { Console.WriteLine("Child Constructor."); } public static void Main() { ChildClass child = new ChildClass(); child.print(); } } Output: Child Constructor. I'm a Parent Class. public class ParentClass { virtual public void print() { Console.WriteLine("I'm a Parent Class."); } } Inheritance operator

Prepared by Jack Chan, Spring 2007 Object Oriented Concepts - Inheritance Override methods Use the same name to override the method Only virtual methods can be overrided public class ChildClass : ParentClass { public ChildClass() { Console.WriteLine("Child Constructor."); } virtual public void print() //override { Console.WriteLine(“I’m a child!”); } public static void Main() { ChildClass child = new ChildClass(); child.print(); } } Output: Child Constructor. I'm a child!

Prepared by Jack Chan, Spring 2007 Course Project “SuperPang” Specification: Phase 1: 23 February, 2007 (Fri) Phase 2: 23 March, 2007 (Fri) Phase 3 + Special features + Report: 13 April, 2007 (Fri) Demonstration: the week of 16 April, 2007

Prepared by Jack Chan, Spring 2007 Course Project Plan carefully before coding How many classes do you need? Do those objects have similar properties? How the special functions could be added easily in the future Flying Object BalloonStoneBullet

Prepared by Jack Chan, Spring 2007 Course Project Use Windows Form Application (Lecture Note, P.52) instead of Console Application (Lecture Note, P.50) Do not spend too much time on beautiful graphics No Plagiarism

Prepared by Jack Chan, Spring 2007 Chan An, Jack Office: SHB 825 Office Hour: Tuesdays 11:30am – 12:15pm