Object Oriented Analysis and Design

Slides:



Advertisements
Similar presentations
Classes & Objects INTRODUCTION : This chapter introduces classes ; explains data hiding, abstraction & encapsulation and shows how a class implements these.
Advertisements

Object-Oriented programming in C++ Classes as units of encapsulation Information Hiding Inheritance polymorphism and dynamic dispatching Storage management.
Constructor. 2 constructor The main use of constructors is to initialize objects. A constructor is a special member function, whose name is same as class.
Contents o Introduction o Characteristics of Constructor. o Types of constructor. - Default Constructor - Parameterized Constructor - Copy Constructor.
C++ Classes & Data Abstraction
Road Map Introduction to object oriented programming. Classes
1 C++ Structures Starting to think about objects...
C++ Classes & Object Oriented Programming. Object Oriented Programming  Programmer thinks about and defines the attributes and behavior of objects. 
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Classes Mark Hennessy Dept. Computer Science NUI Maynooth C++ Workshop 18 th – 22 nd Spetember 2006.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 19 Clicker Questions November 3, 2009.
CSE 333 – SECTION 4. Overview Pointers vs. references Const Classes, constructors, new, delete, etc. More operator overloading.
Learners Support Publications Pointers, Virtual Functions and Polymorphism.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
CS212: Object Oriented Analysis and Design Lecture 6: Friends, Constructor and destructors.
Object Oriented Programming with C++/ Session 6 / 1 of 44 Multiple Inheritance and Polymorphism Session 6.
Lecture Set 11 Creating and Using Classes Part B – Class Features – Constructors, Methods, Fields, Properties, Shared Data.
Unit IV Unit IV: Virtual functions concepts, Abstracts classes & pure virtual functions. Virtual base classes, Friend functions, Static functions, Assignment.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
C++ Review (3) Structs, Classes, Data Abstraction.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
Classes In C++ 1. What is a class Can make a new type in C++ by declaring a class. A class is an expanded concept of a data structure: instead of holding.
 Classes in c++ Presentation Topic  A collection of objects with same properties and functions is known as class. A class is used to define the characteristics.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
CONSTRUCTORS AND DESTRUCTORS Chapter 5 By Mrs. Suman Verma PGT (Comp.Sc)
C/C++ 3 Yeting Ge. Static variables Static variables is stored in the static storage. Static variable will be initialized once. 29.cpp 21.cpp.
Chapter 10 Classes and Objects In-Depth. Chapter 10 A class provides the foundation for creating specific objects, each of which shares the general attributes,
Chapter 9 Classes: A Deeper Look, Part I Part II.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 12 Object-Oriented Programming Starting Out with Games & Graphics.
CONSTRUCTOR AND DESTRUCTORS
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.
Object-Oriented Programming (OOP) What we did was: (Procedural Programming) a logical procedure that takes input data, processes it, and produces output.
YG - CS Concept of Encapsulation What is encapsulation? - data and functions/methods are packaged together in the class normally.
Learners Support Publications Constructors and Destructors.
Seventh step for Learning C++ Programming CLASS Declaration Public & Private Constructor & Destructor This pointer Inheritance.
Data Structures Lecture 4: Classes in C++ Azhar Maqsood NUST Institute of Information Technology (NIIT)
Object-Oriented Programming Using C++ Third Edition Chapter 7 Using Classes.
Constructors and Destructors
Procedural and Object-Oriented Programming
Topic: Classes and Objects
Creating and Using Objects, Exceptions, Strings
Static data members Constructors and Destructors
By Muhammad Waris Zargar
Constructors & Destructors.
Road Map Introduction to object oriented programming. Classes
Constructor & Destructor
This technique is Called “Divide and Conquer”.
Object-Oriented Programming Using C++
This pointer, Dynamic memory allocation, Constructors and Destructor
C++ Classes & Object Oriented Programming
Object Oriented Analysis and Design
Corresponds with Chapter 7
CS212: Object Oriented Analysis and Design
Contents Introduction to Constructor Characteristics of Constructor
Classes & Objects: Examples
Starting to think about objects...
Constructors and Destructors
Classes and Objects.
UNIT I OBJECT ORIENTED PROGRAMMING FUNDAMENTALS
CPS120: Introduction to Computer Science
C++ Programming ㅎㅎ String OOP Class Constructor & Destructor.
Object-Oriented Programming Using C++
Introduction to Classes and Objects
CIS 199 Final Review.
NAME 436.
CPS120: Introduction to Computer Science
Chapter 9 Introduction To Classes
Constructors & Destructors
More C++ Classes Systems Programming.
Creating and Using Classes
Presentation transcript:

Object Oriented Analysis and Design Object-Oriented Concepts

OOAD Concepts Class Object Encapsulation Abstraction Inheritance Polymorphism Message passing Dynamic binding

Classes & Objects Data / attributes / field/state Method / Behaviour Describe the characteristics Method / Behaviour Perform operations Perform object to object communication

Classes & Objects Class Object Category or group of things that have the same attributes and the same behaviors. Class is a decryption of properties and behaviors which a collection of same type objects can have Object Instance of a class Object is a bundle of properties and behaviors An object stores its state in fields (variables) and exposes its behavior through methods (functions)

Classes & Objects Attribute/Field/variable Data/Value Student Nimal age 21 Study() Study() Class Object

Classes & Objects Class Object User defined data type Instance of user defined data type Prototype or model Containing features Do not occupy memory Occupy memory Cant manipulate since its not in memory Can manipulate

Classes & Objects class Student { private : int AM; int EM; public : void ReadMarks() cout<<"Enter Assignment Marks : "; cin>>AM; } void printGrade() cout<<"Grade :"<<(AM+AM)/2; }; main() { Student Nimal; Nimal.ReadMarks(); Nimal.printGrade(); getch(); }

Classes & Objects Member functions defined outside class Binary scope resolution operator (::) ties member name to class name scope resolution operator help uniquely identifying functions of a particular class Different classes can have member functions with same name

Classes & Objects class Student { private : int AM; int EM; public : void ReadMarks(); void printGrade(); }; void Student::ReadMarks() cout<<"Enter Assignment Marks : "; cin>>AM; cin>>AM; } void Student::printGrade() { cout<<"Grade :"<<(AM+AM)/2; } main() Student Nimal; Nimal.ReadMarks(); Nimal.printGrade(); getch();

Constructors Constructors are special member functions of any class, which are invoked at the moment an instances of the class are created. They are special functions that have the same name as their class. Have the same name as the class. It may take arguments. It cannot return a value [including void].

Constructors Default Constructor Parameterized Constructor Accepts no parameters Called if no user-defined constructors Parameterized Constructor A constructor that receives arguments/parameters Class:: Circle() {} Circle::Circle(int r) { radius = r;}

Destructors Special member function Having same name as class Preceded with tilde (~) No arguments No return value Cannot be overloaded Invoked before system reclaims object’s memory Used in reusing memory for new objects

Pointers Memory location which hold the address of another memory location/ variable int x=5; int *p; p= &x; *p=10;