Example for creating MFC User Interface Thread

Download source code User Interface Thread
Some time back we saw how to build an application that uses a worker thread. A worker thread is used to perform background tasks that receive no direct input from the user. Unlike this user-interface(UI) threads are used to create windows and process messages sent to those windows. In this [...]

Tab order of controls placed in a dialog box.

Sometimes, especially when we are using spin button controls or radio buttons, the order in which we are creating controls is very important. Spin button controls considers the control created just before it as its buddy whereas radio buttons to be grouped must have ids in sequence.  Any small mistake in creating controls may result [...]

How to overload new operator?

For a specific class it is a better approach to overload new operator. The new function always returns a void pointer and takes the argument of type size_t. The object of size_t contains size of the object being allocated. Definition of new function which allocates memory for the object of class emp is as follows:
void [...]

Explain ‘register’ storage class.

main( )
{
register int a, *p1, *p2 ;
int b ;
clrscr( ) ;
p1 = &a ;
p2 = &b ;
printf ( “%u %u”, p1, p2 ) ;
getch( ) ;
}
Here, a is an integer variable, p1 and p2 are pointers. These all variables are of register storage class. This program would flash a compiler error because we are storing [...]

Printing Through .NET

Any sophisticated application would definitely have support for printing. .NET facilitates printing with the help of a PrintDocument component. Along with this we can make use of the various dialog boxes that are commonly used for printing.
The PrintDocument Component
[...]

General Tips To Overcome An Interview

Campus So what if you are not a mountaineer. Or a keen hiker. You still cannot treat your interview like a careless morning trot along a jogger’s path. Your jaw-jaw at the interview table is nothing less than a cautious climb up a mountain trail–which begins around your early childhood and meanders through the years [...]

What is downcasting?

Consider the following example:class B { … };class D : public B { … };void f(){B* pb = new D; // unclear but okB* pb2 = new B;D* pd = dynamic_cast(pb); // ok: pb actually points to a D…D* pd2 = dynamic_cast(pb2); //error: pb2 points to a B, not a D// pd2 == NULL…}This type [...]

What is a class?

According to Rumbaugh & Co, “an object class describes a group of objects with similar properties (attributes), common behavior (operations), common relationships to other objects, and common semantics.” In one word class is a type. This is a way to create a new types of objects in C++. You may then proceed to explanation on [...]

C language Interview Questions And Answers

With respect to function parameter passing, what is the difference between call-by-value and call-
How can I write a function that takes a variable number of arguments? What are the limitations
Can we declare a function that can return a pointer to a function of the same type?
How to declare an array of N pointers to functions [...]

Can base class reference is initialized with derived class object ?

We can declare a reference  to base class and initialize it with derived class’s object as shown in the following program..
#include <iostream.h>
class B
{
public:
int i ;
B( )
{
}
} ;
class D : public B
{
public:
D( )
{
}
} ;
main( )
{
D d ;
B &b = d ;
}

  • Categories