Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: C++
Expertise: Beginner
Sep 25, 2000

Helper Functions

The interface of a class consists of its public members. Usually, private members represent implementation details and are not exposed to other classes and users. Private members can be member functions, not just data members. When is it useful to declare member functions private? Suppose you have a multimedia player class whose public member functions, e.g., play(), zoom() and stop(), call internal member functions, or helper functions, that take care of internal operations such as managing memory buffers, threads and files. These internal operations are not supposed to be used by any other classes or users because they are highly specialized and deal with low-level facilities such as physical devices and memory pages. As you can see these helper functions can vary with each new release or port to another platform. Therefore, they are declared private. Another example, Shape::Draw() can call low-level, platform-dependent functions that initialize screen drivers and define a client area. Declare such internal members private if they are meant to be used only in class Shape.
Danny Kalev
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date