Monday, 4 March 2013

Event handlers and scroll bars


Event handlers and scroll bars
Objects and classes are two fundamental concepts in object-oriented languages like C++.
An object is a thing — anything that appears on the screen and contains functions and
variables wrapped up together to perform a discrete task. This grouping together is called
encapsulation. For example, all the screen handling parts of a program might be put
together in an object called screen. This screen object could include both the data to be
displayed on the screen and the functions (or methods) to handle that data, like OnDraw()
or drawLine().
A class is a description (or template) that is used to create an object. In the class
definition, data and methods for handling the data are In C++ programming, classes are
defined and objects of that class (which can be thought of as variables of that class’s type)
are created in the source code (.cpp) files. Visual C++ comes complete with a library of
predefined classes, the MFC library, which saves a great deal of work. When we create
labels or command buttons, we are creating objects of those types.
Visual C++ also supports inheritance. Using inheritance, a derived class can inherit all the
properties of its base class and have extra features added.
Access modifiers are keywords used to set the scope of data members and functions
within classes. The private keyword means that only objects of that class have access to
that data member or function. It is usual to declare all data members as private. The public
keyword means that that member is available to all other parts of the program. The
protected keyword is used to give access to objects of that class or derived from that class
by inheritance.

Events are things that happen on the screen. Event handlers transfer data to methods
that complete the task.

No comments:

Post a Comment