Monday, March 22, 2010

C++ program to illustrate the execution of constructors and destructors

#include
// program to illustrate the execution of constructors and destructors
class A
{
public:
A()
{
cout<< "constructor to A is invoked\n";
}
~A()
{
cout<<"destructor to A is invoked\n";
}

};

class B
{
public:
B()
{
cout<< "constructor B invoked\n";
}
~B()
{
cout<<"destructor B invoked\n";
}
};
class C: virtual public A
{

public:
C()
{

cout<<"constructor to C invoked\n";
}
~C()
{
cout << "destructor to C invoked\n";
}
};
class D:virtual public A
{
public:
D()
{
cout<<"constructor to D invoked\n";
}
~D()
{
cout << "Destructor D invoked\n";
}
};
class E
{
public:
E()
{
cout<<"constructor to E invoked\n";
}
~E()
{
cout<<"Destructor to E invoked\n";
}
};
class F:public C,public B,public D,public E
{
public:
F()
{
cout<<"constructor to F invoked\n";
}
~F()
{
cout<<"destructor to F invoked\n";
}
};

void main()
{
F Fvar;
cout<<"program over\n";
}

Action Method in Mvc

In this section, you will learn about the action method of controller class. All the public methods of a Controller class are called Act...