1 / 13

Object Oriented Analysis and Design

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 Describe the characteristics Method / Behaviour

castroe
Download Presentation

Object Oriented Analysis and Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object Oriented Analysis and Design Object-Oriented Concepts

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

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

  4. Classes & Objects • Class • 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)

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

  6. Classes & Objects

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

  8. 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

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

  10. 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].

  11. Constructors • Default 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;}

  12. 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

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

More Related