Help

Hi,
im using codeblocks, first of all

1
2
3
4
5
6
class Class
{
    public:
    void Function1() {std::cout<<"Function1"<<std::endl;}
    void Function2() {}
};


how do you call Function1 in Function2?
i tried doing {Class::Function1();}
and i get the Error : cannot call member function 'char Class::Function1()' without object
Last edited on
closed account (zb0S216C)
You need to instantiate Class before calling any non-static members. For example:

1
2
3
Class NewClass;

NewClass.Function1( );

Note the use of the member operator (.).

Wazzak
Topic archived. No new replies allowed.