Data Structure and Algorithms Tutorial 5 PDF
Document Details
Uploaded by RichWildflowerMeadow
Nile University
Eng. Kareem Moussa
Tags
Summary
This document is a tutorial on object-oriented programming (OOP) concepts, specifically focused on data structures and algorithms. It introduces classes, objects, and access specifiers. The tutorial is likely part of a computer science course.
Full Transcript
Data Structure and Algorithms ECE251 Tutorial 5 Object Oriented Programming (OOP) Eng. Kareem Moussa AI Engineer Teaching Assistant (TA) - Electronics and Computer Engineerin...
Data Structure and Algorithms ECE251 Tutorial 5 Object Oriented Programming (OOP) Eng. Kareem Moussa AI Engineer Teaching Assistant (TA) - Electronics and Computer Engineering - Nile University IEEE Egypt Special Interest Group on Humanitarian Technology (SIGHT) Executive Committee Member (Secretary) Classes and Objects A Class is like a blueprint and objects are like houses built from the blueprint Object-Oriented Programming Terminology attributes: members of a class methods or behaviors: member functions of a class Access Specifiers Used to control access to members of the class public: can be accessed by functions outside of the class private: can only be called by or accessed by functions that are members of the class protected: can only be called by or accessed by functions that are members of the class and derived (subclass) classes Class Example Private Members Public Members Defining an Instance of a Class An object is an instance of a class Defined like structure variables: Rectangle r; Access members using dot operator: r.setWidth(5.2); cout