Hi, I would explain what I want to do, but I think that the code explains better. Basically, I need that an initialization and finalization code are executed before (and after) different other functions (sorry, very bad explanation), here is the code:
Code:
#include <iostream>

using namespace std;

class A {
public:
		void action() {
				cout << "Before update." << endl;
				update();
				cout <<	"After update." << endl;			
		}

		virtual void update() {
				cout << "Updating class A." << endl;
		}		
};


class B : public A {
public:
		void update() {
				cout << "Updating class B." << endl;
		}
};


class C : public A {
public:
		void update() {
				cout << "Updating class C." << endl;
		}
};

int main()
{
		C c;
		B b;

		b.action();
		c.action();

		return 0;
}
Is this code "portable" and "right"?