Error: Function not declared in the scope
Because in the call:

 dofun();


you should put from which class you are calling that function.
In your case:

AllTimer::dofun();


in that case your function must be declared as static method.

EDIT:
Thanks to the comment:

I'm not pretty sure if your code reflects what you want to do. Because you can create your timer after defining the class:

Alltimer mytimer;


and call the method as a normal function (it must be declared as public):

ISR (TIMER1_OVF_vect)
{
    mytimer.dofun();
}


But it is hard to say since I m not sure what you want to do.