//this gives initialisation error;
of course it does. you haven't actually created an instance of an object of type class1. you created a pointer to an object, and they you didn't point it to anything.
class1 *temp = new class1;