6
Data abstraction - just a way of thinking about how you would solve a p roblem without worrying about the computer language tools you need to solve the problem Focus on problem, what you would need to implement your solution - in general terms Don't be concerned about what data types do or don't exist in computerl anguage When you are ready to implement your ADT consider the following - The data types you need to use and what operations you have performed These two things constitute an abstract data type or ADT Fall into 4 categories Constru ctor - creates dat a for the ADT Transformer/Mutator/Setter - modifies data in ADT Observer/Accessor/Getter - allows you to look but not touch the data in ADT Iterator - provid es the abili ty to move through the comp onents in ADT - one at a time Example set Type - grades Data or fields Name - character array of 20 elements (represents students name) Id - an inte ger - represe nts students numbe r Marks - an array o f intege rs - for stori ng marks Operations - setName - transf ormer type operat ion setID - a transformer type operat ion setMarks - a transforme r type operation Reporter - an observe r type operati on Theory and abstraction are f ine - sometimes helpful to relate thi s to some practicle knowledge in order to put concepts into place Classes - the most common way i n which ADTs are implemented in c++ Class members - priva te Structure members - publ ic In c - structures did not contai n operatio ns Nowada ys - structu res can have operat ions - not reccomended - makin g all data and operat ions pu blic does not follow good object oriented design Code that follows good object oriente d design typically has data that is private and uses "setter s" and "getters" to respectively modify and return the values of the data Declaring and using classes is similar to declaring and using structure s in C++ First - declare class (or structure) and then declare the instances of the class (or structure) 1.1 Sunday, April 3, 2016 8:35 PM  Computer Science 201 -Elementary Data Structures Page 1

COM Scie 201 1.1

Embed Size (px)

Citation preview

Page 1: COM Scie 201 1.1

8/16/2019 COM Scie 201 1.1

http://slidepdf.com/reader/full/com-scie-201-11 1/6

Page 2: COM Scie 201 1.1

8/16/2019 COM Scie 201 1.1

http://slidepdf.com/reader/full/com-scie-201-11 2/6

Page 3: COM Scie 201 1.1

8/16/2019 COM Scie 201 1.1

http://slidepdf.com/reader/full/com-scie-201-11 3/6

Page 4: COM Scie 201 1.1

8/16/2019 COM Scie 201 1.1

http://slidepdf.com/reader/full/com-scie-201-11 4/6

Page 5: COM Scie 201 1.1

8/16/2019 COM Scie 201 1.1

http://slidepdf.com/reader/full/com-scie-201-11 5/6

Page 6: COM Scie 201 1.1

8/16/2019 COM Scie 201 1.1

http://slidepdf.com/reader/full/com-scie-201-11 6/6