Q:

Why can you specify the parameter type of exception specification? 

Why can you specify a type of the parameter for the throw keyword when you can throw another type anyway?  An example:
class A {};
class B {};

void tryexcept() throw(B*)
{
    B* b = new B();
    A* a = new A();
    throw (a); // It works pretty smooth? 
}
Int main()
{
try {
        tryexcept();
    }
    catch (A* style)
    {
        cout << "in handler for A\n";

    }
    catch (B* style)
    {
        cout << "in handler for B\n";

    }
    catch (...)
    {
        cout << "in handler for everything\n";

    }
return 0;
}

Output:
in handler for A
Btw.  I am using Visual Studio. 
But in the function declaration, I set the parameter type of throw to B*, so how can I throw an object of type A*?  I mean it works just as if I had declared the function like void tryexcept() throw(A*) since the right catch block is being used. 

A:

According to Microsoft's own documentation see here and here, Visual Studio departs from the C++ standard in how it treats dynamic exception specifications. 
It treats this case as if you wrote void tryexcept() throw().  std::unexpected does not get called in this case if using Visual Studio.  The Microsoft documentation warns that the program may not run correctly if an exception is thrown from the function, the expectation is that one won't be.  It appears to have "worked" in this case. 
The C++ standard behavior should be that std::unexpected is called if an attempt is made to throw an exception of a type not specified, and in turn std::unexpected should call terminate(). 
And this feature is deprecated in C++11 and onward.