Data Structures and ADTs

Slides:



Advertisements
Similar presentations
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
Advertisements

Lesson 13 Introduction to Classes CS1 Lesson Introduction to Classes1.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. Chapter 17 Templates.
Department of Computer Engineering Faculty of Engineering, Prince of Songkla University 1 5 – Abstract Data Types.
1 Classes and Data Abstraction Chapter What a Class ! ! Specification and implementation Private and public elements Declaring classes data and.
1 Abstract Data Types Chapter 1. 2 Objectives You will be able to: 1. Say what an abstract data type is. 2. Implement a simple abstract data type in C++
1 Chapter 11 Structured Types, Data Abstraction and Classes Dale/Weems/Headington.
1 Using Classes Object-Oriented Programming Using C++ Second Edition 5.
Classes Mark Hennessy Dept. Computer Science NUI Maynooth C++ Workshop 18 th – 22 nd Spetember 2006.
Abstract Data Types Using Classes Lecture-5. Abstract Data Types Using Classes Representing abstract data types using C++ We need the following C++ keywords.
Chapter 9 Defining New Types. Objectives Explore the use of member functions when creating a struct. Introduce some of the concepts behind object-oriented.
Chapter 7 Objects and Classes 1 Fall 2012 CS2302: Programming Principles.
Copyright © 2012 Pearson Education, Inc. Chapter 13: Introduction to Classes.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13: Introduction to Classes.
Session 08 Module 14: Generics and Iterator Module 15: Anonymous & partial class & Nullable type.
ABSTRACT DATA TYPES Data types, data structures, abstract data types, Java/C++ classes, C++ structs.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
Data Structures Using C++1 Chapter 1 Software Engineering Principles and C++ Classes.
 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.
Simple Classes. ADTs A specification for a real world data item –defines types and valid ranges –defines valid operations on the data. Specification is.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved More about.
Chapter 3 Part I. 3.1 Introduction Programs written in C ◦ All statements were located in function main Programs written in C++ ◦ Programs will consist.
More C++ Bryce Boe 2013/10/23 CS24, Fall Outline Project 1 Review Alignment and Padding Finish C++ Introduction.
Copyright © 2002 W. A. Tucker1 Chapter 10 Lecture Notes Bill Tucker Austin Community College COSC 1315.
Slide 1 Chapter 6 Structures and Classes. Slide 2 Learning Objectives  Structures  Structure types  Structures as function arguments  Initializing.
Object Oriented Programming. OOP  The fundamental idea behind object-oriented programming is:  The real world consists of objects. Computer programs.
72 4/11/98 CSE 143 Abstract Data Types [Sections , ]
Copyright © 2015, 2012, 2009 Pearson Education, Inc., Publishing as Addison-Wesley All rights reserved. Chapter 13: Introduction to Classes.
1 Data Structures CSCI 132, Spring 2014 Lecture 2 Classes and Abstract Data Types Read Ch Read Style Guide (see course webpage)
ENEE150 – 0102 ANDREW GOFFIN Abstract Data Types.
Structure A Data structure is a collection of variable which can be same or different types. You can refer to a structure as a single variable, and to.
Nyhoff, ADTs, Data Structures and Problem Solving with C++, Second Edition, © 2005 Pearson Education, Inc. All rights reserved More about.
Chapter 11: Abstract Data Types Lecture # 17. Chapter 11 Topics The Concept of Abstraction Advantages of Abstract Data Types Design Issues for Abstract.
CSIS 123A Lecture 1 Intro To Classes Glenn Stevenson CSIS 113A MSJC.
1 Chapter 12 Classes and Abstraction. 2 Chapter 12 Topics Meaning of an Abstract Data Type Declaring and Using a class Data Type Using Separate Specification.
Chapter 12 Classes and Abstraction
TK1924 Program Design & Problem Solving Session 2011/2012
Andrew(amwallis) Classes!
Structures and Classes
Procedural and Object-Oriented Programming
C# for C++ Programmers 1.
C++ Templates.
Review: Two Programming Paradigms
About the Presentations
Introduction to Classes
More about OOP and ADTs Classes
INTRODUCTION TO OBJECT-ORIENTED PROGRAMMING (OOP) & CONCEPTS
Templates.
Using local variable without initialization is an error.
Object Based Programming
CS148 Introduction to Programming II
Introduction to Classes
Classes and Data Abstraction
Object-Oriented Programming
Built-In (a.k.a. Native) Types in C++
More about OOP and ADTs Classes
Chapter 9 Objects and Classes
Dr. Bhargavi Dept of CS CHRIST
Classes and Objects.
Object-Oriented Programming
COP 3330 Object-oriented Programming in C++
Object-Oriented Programming
Object-Oriented Programming
Introduction to Classes and Objects
Oriented Design and Abstract Data Type
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
C++ data types.
Classes and Objects Systems Programming.
Presentation transcript:

Data Structures and ADTs Chapter 3

C++ Data Types Fundamental (or simple or scalar): Structured: Data objects are single objects int, double, char, bool, complex, the related types (unsigned, short, etc.) enumerations Structured: Collections of data arrays, structs, unions, classes, valarrays, bitsets, the containers and adapters in STL

Structs vs. Classes Similarities Essentially the same syntax Both are used to model objects with multiple attributes (characteristics) represented as data members also called fields … or … instance or attribute variables). Thus, both are used to process non-homogeneous data sets.

Structs vs. Classes Differences No classes in C Members public by default Can be specified private Both structs and classes in C++ Structs can have members declared private Class members are private by default Can be specified public

Advantages in C++ (structs and Classes) C++ structs and classes model objects which have: Attributes represented as data members Operations represented as functions (or methods) Leads to object oriented programming Objects are self contained "I can do it myself" mentality They do not pass a parameter to an external function

Designing a Class Data members normally placed in private: section of a class Function members usually in public: section Typically public: section followed by private: although not required by compiler

Rationale Data members are typically private Cannot be accessed outside class Application programs must interact with an object through its interface Public member functions control interaction between programs and class. Application programs need not know about implementation!

Separate Implementation Details from Application Code If NOT … change in implementation forces change in the application code Increased upgrade time Increased programmer cost Decreased programmer productivity Reduced profits due to Delayed releases/upgrades Loss of customer confidence in software reliability

Traditional Implementation Specification of class in .h file Implementation in .cpp file Forces data abstraction separates interface from interface details Increased use of templates changes this specification and implementation must be in same file thus the dropping of the .h from standard class libraries they are really class-template libraries