1 / 13

OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++

OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++. Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU. Introduction To OOP. OOP is an approach for writing software in which data and behavior are packaged together as classes whose instances are objects

mimms
Download Presentation

OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++

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 PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU

  2. Introduction To OOP • OOP is an approach for writing software in which data and behavior are packaged together as classes whose instancesare objects • A class is a named software representation for an abstraction, where • An abstractionis a named collection of attributes and behavior relevant to modeling a given entity for some particular purpose, • An objectis a distinct instance of a given class that is structurally identical to all other instances of that class. • Software code in OOP is written to define classes, instantiate objects, and manipulate these objects.

  3. Abstraction

  4. Mapping Abstractions

  5. Class Structure

  6. Object Structure

  7. Summary of the Course This is a project-based, lab-oriented course aimed at learning the fundamentals of Object-Oriented Program development in C++. Topics include 1. Object-Oriented programming concepts 2. The C++ Program Structure 3. The C++ Data Types 4. Functions, Scope, and the Free Store 5. The C++ class 6. Operator Overloading 7. Class Derivation and inheritance 8. Multiple inheritance, and polymorphism 9. Object-Oriented Analysis and Design 10 OOP testing techniques

  8. Basic Concepts of OOP 1. Simulating the behaviorof objects ( e.g...., an array of data structures can be sorted or indexed, a stack can be used for pushing or popping data). OOP concepts are based on the concepts of Computer Simulation. 2. Abstract Data Types (ADTs) consists of {data structures + operations or functions}, (e.g....., a Matrix can be defined as an ADT consisting of a 2- dimensional array + the operations of inverse, transpose, and other operations and methods which can be applied to objects of type Matrix). 3. Hiding implementation details using encapsulation, where each class of objects consists of a private section, a protected section, and a public section. Data structures and functions in a private class section can only be accessed locally within the class. The protected class section can also be accessed by derived classes.

  9. Basic Concepts of OOP 4. Reusing code through inheritance.A hierarchy of classesallow derived classes to inherit code (i.e.., data structures and functions) defined in parent classes. For example, Matrix Nonsingular Singular Square

  10. Basic Concepts of OOP 5. Function and Operator Overloading. A class may contain several functions with the same function name but with different arguments, or operators such as + , -, *, and / are used to define operations on different objects, e.g.... matrix multiply can be defined as A * B, where A and B are objects of type Matrix. 6. Polymorphism where objects of distinct classes can be manipulated using only knowledge of their common properties without regard for their exact class.

  11. Basic Concepts of OOP * The dynamic binding mechanism determines the type of the object and maps the invocation to the correct method in class X, if the object is of class X, or to the correct method in class Y, if the object is of class Y (e.g., the function F() could be a print() function, and the algorithm is unaware of the exact type of object to be printed, it invokes the function using a base class of classes X and Y).

  12. Basic Concepts of OOP 7. The use of templates to design generic classes of objects

  13. Basic Concepts of OOP 8. The use of friend functions and friend classes to access all the functions and data types of other classes (violates the concept of information hiding; adds needed flexibility and should only be used when necessary). 9. Design using Class Libraries and Design Patterns

More Related