its showing u error coz u r using a1 as a member access u need to define a class variable as addition a1
and then use a1 and it will work fine.....always c++ needs a variable which acts as a class which inturn can access class objects and methods....