









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
An overview of data abstraction, explaining it as a concept of abstract data types (adts) with their type implementation and operations hidden from the user. The document also covers the benefits of adts for both manufacturers and clients. A complex number adt example is given, including how to declare, create, add, and use complex numbers in c. The document also discusses the support of adts in c and the introduction of classes in c++ as a more object-oriented alternative.
Typology: Slides
1 / 15
This page cannot be seen from the preview
Don't miss anything!
implementation interface
manufacturer’s responsibility client client client use
Complex c1, c2, c3;
struct complex { double real, imag; } typedef struct complex Complex;
c1 = create_complex(2, 3); /* conceptually, c1 = 2+3i */
c3 = add_complex(c1, c2); /* conceptually, c3 = c1 + c2 */
Complex add_complex(Complex c1, Complex c2); { Complex csum; csum.real = c1.real + c2.real; csum.imag = c1.imag + c2.imag; return csum; }
int main() { Complex c1, c2, c3; c1 = create_complex(2, -3); c2 = create_complex(2, 9); c3 = add_complex(c1, c2); print_complex(c3); return 0; } /* Implementation of Complex functions */ :