  Introduction  What the generic.  What are the Generic types : - Class - Methods   Type of coding the generic method. - Using the generic method.

Slides:



Advertisements
Similar presentations
Introduction to Assembly language
Advertisements

The Pseudocode Programming Process Chapter 9. Outline  Introduction  Design the routine.  Code the routine.  Check the code.  Clean up loose ends.
Variable types We have already encountered the idea of a variable type. It is also possible to think about variables in terms of their kind, namely: 1)
ITEC200 – Week03 Inheritance and Class Hierarchies.
 2006 Pearson Education, Inc. All rights reserved Generics.
Types(2). 2 Recursive Problems  One or more simple cases of the problem have a straightforward, nonrecusive solution  The other cases can be redefined.
Department of Computer Science A Static Program Analyzer to increase software reuse Ramakrishnan Venkitaraman and Gopal Gupta.
CS221 - Computer Science II Polymorphism 1. CS221 - Computer Science II Polymorphism 2 Outline  Explanation of polymorphism.  Using polymorphism to.
Computer Engineering Rabie A. Ramadan Lecture 5.
CS212: Object Oriented Analysis and Design Lecture 14: Reusing classes in C++
Refactoring. Refactoring Overview  What is refactoring?  What are four good reasons to refactor?  When should you refactor?  What is a bad smell (relative.
Ordered Linked Lists using Abstract Data Types (ADT) in Java Presented by: Andrew Aken.
Arrays. Topics to be Covered... Arrays ◦ Declaration ◦ Assigning values ◦ Array manipulation using loops Multi-dimensional arrays ◦ 2D arrays ◦ Declaration.
Mid-Year Review. Coding Problems In general, solve the coding problems by doing it piece by piece. Makes it easier to think about Break parts of code.
Lecture 17: 4/4/2003CS148 Spring CS148 Introduction to Programming II Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 9: Arrays; Revision Session.
1 Topic 5 Polymorphism "“Inheritance is new code that reuses old code. Polymorphism is old code that reuses new code.”
Review for Test2. Scope 8 problems, 60 points. 1 Bonus problem (5 points) Coverage: – Test 1 coverage – Exception Handling, Switch Statement – Array of.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
Arrays 4/4 By Pius Nyaanga. Outline Multidimensional Arrays Two-Dimensional Array as an Array of Arrays Using the length Instance Variable Multidimensional.
Motivation for Generic Programming in C++
Recursion Recursion is a fundamental programming technique that can provide an elegant solution certain kinds of problems © 2004 Pearson Addison-Wesley.
Sections Inheritance and Abstract Classes
Pointers and Linked Lists
Pointers and Linked Lists
CSE687 - Object Oriented Design class notes Survey of the C++ Programming Language Jim Fawcett Spring 2004.
Fundamental of Java Programming
Lightweight introduction
Java Unit 11: Inheritance I
Array Array is a variable which holds multiple values (elements) of similar data types. All the values are having their own index with an array. Index.
Lightweight introduction
PRINCIPALES OF OBJECT ORIENTED PROGRAMMING
This pointer, Dynamic memory allocation, Constructors and Destructor
Object-Oriented Programming (OOP) Lecture No. 32
Charles Phillips screen
CSC 253 Lecture 8.
Chapter 16: Introduction
CSC 253 Lecture 8.
Concepts From Alice Switching to Java Copyright © Curt Hill.
Polymorphism.
CMSC 202 Lesson 22 Templates I.
Andy Wang Data Structures, Algorithms, and Generic Programming
Closure Representations in Higher-Order Programming Languages
Functions Chapter 9 Copyright © 2008 W. W. Norton & Company.
Lesson 7. Events, Delegates, Generics.
Topic 5 Polymorphism "“Inheritance is new code that reuses old code. Polymorphism is old code that reuses new code.”
Test Driven Development
Chapter 9: Value-Returning Functions
CPS120: Introduction to Computer Science
Which best describes the relationship between classes and objects?
Non-Calculator Questions
CSC 220 – Processing Spring, 2017
Templates I CMSC 202.
Selenium HP Web Test Tool Training
Test Driven Development
Isolation Forest B 工海三 顧家琛.
Generic Programming.
Groovy.
Templates Generic Programming.
Multivariable Linear Systems
F T T T F.
Templates CMSC 202, Version 4/02.
Group 4: Song Li, Ying Lu, Hexin Wang, and Michael Walker May 1, 2000
JavaScript 101 Lesson 8: Loops.
Templates Generic Programming.
How Do You Describe the Location of an Object?
Modern Collections Classes & Generics
Methods Scope How are names handled?
SPL – PS2 C++ Memory Handling.
Introduction to Classes and Objects
Presentation transcript:

  Introduction  What the generic.  What are the Generic types : - Class - Methods   Type of coding the generic method. - Using the generic method within non-generic class - Using the generic method within generic class  Features of Generics - Example for Generic  What is the main different between the generic and non-generic class.  What is the main different between the generic and non-generic methods. outline

  Generics are the most powerful feature of C#. Generics allow you to define type-safe data structures, without committing to actual data types. This results in a significant performance boost and higher quality code, because you get to reuse data processing algorithms without duplicating type-specific code. Introduction

  What the generic?  allow you to delay the specification of the data type of programming elements in a class or a method, until it is actually used in the program. In other words, generic allow you to write a class or method that can work with any data type.  You write the specifications for the class or the method, with substitute parameters for data types. When the compiler encounters a constructor for the class or a function call for the method, it generates code to handle the specific data type. What the generic

  What are the Generic types :  Class  Methods Generic types

 Generics types

 - The easy way to write the generic class is :- class nameclass { } - We can use the variable with type of public T students; Generics types

 Type of coding the generic method

 Features of Generics

 1- code the class EXAMPLE

 2- code the button1((int)) 3- code the button2 ((char)) EXAMPLE

  What is the main different between the generic and non-generic class? Generic class:- 1- This class can operate on any kind of object. 2- These objects each can operate on different type of data. Different between the generic and non-generic class.

 Different between the generic and non-generic methods