lecture-7 - 23 SEPARATING INTERFACE FROM IMPLEMENTATION •...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
Object Oriented Programming – Introduction to C++ R.B. Lenin Winter 2006 DA -I I C T 23 SEPARATING INTERFACE FROM IMPLEMENTATION • Easier to modify programs • If functions are defined in the class itself, they all are treated as inline functions by default – no more inline if we separate the interface • C++ programs can be split into Header files – contains class definitions and function prototypes
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Object Oriented Programming – Introduction to C++ R.B. Lenin Winter 2006 DA -I I C T 24 Controlling Access to Members • Purpose of public – Give clients a view of the services the class provides (interface) • Purpose of private – Default setting – Hide details of how the class accomplishes its tasks (implementation) Private members only accessible through the public interface using
Background image of page 2
Object Oriented Programming – Introduction to C++ R.B. Lenin Winter 2006 DA -I I C
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Object Oriented Programming – Introduction to C++ R.B. Lenin Winter 2006 DA -I I C T 26 time1.h: In function `int main()': time1.h:16: error: `int Time::hour' is private cpp_classp1_s4.cpp:14: error: within this context
Background image of page 4
Object Oriented Programming – Introduction to C++ R.B. Lenin Winter 2006 DA -I I C T 27 Access Functions and Utility Functions • Utility functions private functions that support the operation of public functions – Not intended to be used directly by clients • Access functions public functions that read/display data or check conditions •N e x
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Object Oriented Programming – Introduction to C++ R.B. Lenin Winter 2006 DA -I I C
Background image of page 6
Object Oriented Programming – Introduction to C++ R.B. Lenin Winter 2006 DA -I I C
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Object Oriented Programming – Introduction to C++ R.B. Lenin Winter 2006 DA -I I C
Background image of page 8
Object Oriented Programming – Introduction to C++ R.B. Lenin Winter 2006 DA -I I C
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Object Oriented Programming – Introduction to C++ R.B. Lenin Winter 2006 DA -I I C
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 27

lecture-7 - 23 SEPARATING INTERFACE FROM IMPLEMENTATION •...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online