1.11 Introduction to OOP academy.zariba.com 1. Lecture Content 1.What is OOP and why use it? 2.Classes and objects 3.Static classes 4.Properties, fields.

Slides:



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

More about classes and objects Classes in Visual Basic.NET.
Object-Oriented PHP (1)
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Chapter 4 Defining Your Own Classes.
1 Objects and Classes Introduction to Classes Object Variables and Object References Instantiating Objects Using Methods in Objects Reading for this Lecture:
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Basic OOP Concepts and Terms
Object-oriented Programming Concepts
ASP.NET Programming with C# and SQL Server First Edition
2.5 OOP Principles Part 1 academy.zariba.com 1. Lecture Content 1.Fundamental Principles of OOP 2.Inheritance 3.Abstraction 4.Encapsulation 2.
2.5 OOP Principles Part 2 academy.zariba.com 1. Lecture Content 1.Polymorphism 2.Cohesion 3.Coupling 2.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
Chapter 6 Class Inheritance F Superclasses and Subclasses F Keywords: super F Overriding methods F The Object Class F Modifiers: protected, final and abstract.
Lecture 9 Polymorphism Richard Gesick.
An Object-Oriented Approach to Programming Logic and Design
BIM313 – Advanced Programming Techniques Object-Oriented Programming 1.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
JavaScript, Fourth Edition
CSCI-383 Object-Oriented Programming & Design Lecture 13.
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
Chapter 6 Object-Oriented Java Script JavaScript, Third Edition.
Workshop on Graph Theory academy.zariba.com 1. Workshop Contents 1.What are graphs? 2.Are they useful? 3.Implementing our own Generic Graph 4.Depth First.
Object-Oriented Programming in C++
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
Chapter 6 OOP: Creating Object-Oriented Programs Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
1 Classes and Controls CE-105 Spring 2007 By: Engr. Faisal ur Rehman.
Tuc Goodwin  Object and Component-Oriented Programming  Classes in C#  Scope and Accessibility  Methods and Properties  Nested.
Inheritance Building one object from another. Background Object-oriented programming is normally described has offering three capabilities Encapsulation:
Using the Standard.NET Framework Classes Svetlin Nakov Telerik Corporation
1 Chapter 8 – Classes and Object: A Deeper Look Outline 1 Introduction 2 Implementing a Time Abstract Data Type with a Class 3 Class Scope 4 Controlling.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
OOP: Encapsulation,Abstraction & Polymorphism. What is Encapsulation Described as a protective barrier that prevents the code and data being randomly.
Basic OOP Concepts and Terms. In this class, we will cover: Objects and examples of different object types Classes and how they relate to objects Object.
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
Chapter 4 Introduction to Classes, Objects, Methods and strings
Learners Support Publications Object Oriented Programming.
Microsoft Visual Basic 2008 CHAPTER ELEVEN Multiple Classes and Inheritance.
Introduction to Java Chapter 7 - Classes & Object-oriented Programming1 Chapter 7 Classes and Object-Oriented Programming.
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
: Maha Sabri Altememe Lecturer : Maha Sabri Altememe Lecture :1 1.
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 9 Java Fundamentals Objects/ClassesMethods Mon.
Introduction to Object-Oriented Programming Lesson 2.
Introduction to Classes, Objects, Methods and Attributes Lecture # 5.
Computer Programming 2 Lecture 8: Object Oriented Programming Creating Classes & Objects Prepared & Presented by: Mahmoud Rafeek Alfarra MINISTRY OF EDUCATION.
Object Oriented Programming Session # 03.  Abstraction: Process of forming of general and relevant information from a complex scenarios.  Encapsulation:
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
C# Programming: From Problem Analysis to Program Design1 Creating Your Own Classes C# Programming: From Problem Analysis to Program Design 4th Edition.
Seventh step for Learning C++ Programming CLASS Declaration Public & Private Constructor & Destructor This pointer Inheritance.
Geoff Holmes and Bernhard Pfahringer COMP206-08S General Programming 2.
Inheritance Class Hierarchies SoftUni Team Technical Trainers Software University
Creating and Using Objects, Exceptions, Strings
Object-Oriented Design
Object-Oriented Programming Concepts
INF230 Basics in C# Programming
Polymorphism, Interfaces & Operator Overloading
Inheritance and Polymorphism
Module 5: Common Type System
2.2 Defining Classes Part 2 academy.zariba.com.
JavaScript OOP academy.zariba.com.
Section 11.1 Class Variables and Methods
3 Fundamentals of Object-Oriented Programming
Lecture 23 Polymorphism Richard Gesick.
OOP’S Concepts in C#.Net
Using Classes and Objects
Interfaces.
CPS120: Introduction to Computer Science
C++ Programming ㅎㅎ String OOP Class Constructor & Destructor.
Fundaments of Game Design
CIS 199 Final Review.
Presentation transcript:

1.11 Introduction to OOP academy.zariba.com 1

Lecture Content 1.What is OOP and why use it? 2.Classes and objects 3.Static classes 4.Properties, fields and methods 5.Encapsulation 6.OOP structure in C# 7.Namespaces 8.Enumerations and Structs 2

1. What is OOP? Why use it? 3 Object-oriented programming (OOP) attempts to provide a model for programming based on objects. Objects are an abstract data type with the addition of polymorphism and inheritance. An object has both state (data) and behavior (code). Objects are designed in hierarchies. OOP is meant to make it easy both to reuse existing components as well as to easily extend the functionality. OOP will generally make your application structure more logical, easy to follow and self-contained.

2. Classes and Objects 4 A Class can be thought of as a skeleton or a template for a specific object. Classes have a set of attributes (to hold their state) and a set of actions (to hold their behaviours). An Object is the specific instance of a class. Examples: Bank Accounts, Animals, Games

3. Static Classes 5 Static classes cannot be instantiated. They only “exist once”. Examples for static classes: Math, Console, etc.

4. Properties, fields and methods 6 Properties and fields are the data members of a class. They can be variables or constants. Fields do not invoke actions. Properties can contain more complex logic. They have accessors – get or set. Properties can be read-only (get), read and write(get and set) or write-only (set). Examples -> String.Length, Console.BackgroundColor

4. Properties, fields and methods 7 Methods manipulate the data of a class(properties or fields). Methods can be static – they are common for all instances of a class (shared between instances). Examples: Console. …, String. …, Math. …, Constructors are special methods using to assign initial values of the object’s fields. Examples: new String, new DateTime, new Int32 …

5. Encapsulation 8 Encapsulation allows selective hiding of properties and fields to protect the data from accidental corruption. It packs the data/object into a single component which can easily be used. e.g Computer, Remote Control, “Capsules”

6. OOP structure in C# 9 Interfaces, Abstract Classes, Classes, Inheritance and Objects.

7. Namespaces 10 Namespaces are like “folders” to help you organize your classes, interfaces and Object-Oriented structure.

8. Enumerations and Structs 11 Structs are similar to classes. Structs are value types, while classes are reference types. Structs are normally used only to store data (no methods). E.g. Geometrical Coordinates. Enumerations are simply lists of objects under a common name.

Homework *Optional* Create a class diagram in a C# Console Application and add at least 50 (total) classes, abstract classes, interfaces, properties and methods for your favourite game. e.g. LOL, WOW, Dota 2, CS … etc. You can include weapons, characters, spells, mana, health, damage, speed etc.

13 References

14 Zariba Academy Questions