tags:

views:

81

answers:

1

I have this code:

header - test.h

Inside header I have some class A and definitions of two functions quiz and quiz2

void quiz(int i);

void quiz2(A a, A const *pa);

I call function quiz2 from quiz

A a1(i);
A *pa1 = new A(a1);
quiz2(a1, pa1);

this is implementation of the function:

  void quiz2(A a, A const *pa){
        int i = a;
        cout << i << endl;
}

but in my header I receive 3 errors near the line of definition of quiz2:

Multiple markers at this line
    - initializer expression list treated as compound 
     expression
    - `A' was not declared in this scope
    - variable or field `quiz2' declared void

can somebody please explain why? thanks in advance

A: 

I forgot that I must declare firstly classes and only after that functions, so now it's working

lego69
When making updates like this, please edit the original post. SO is not a forum or blog.
John Dibling
But @John, this isn't just an update to the question. It's the *answer* to the question. His failure to declare things in the right order is what caused the compiler errors. The solution to the errors was to change the declaration order. This answer could be phrased better, but it's still an answer. +1.
Rob Kennedy
@Rob Kennedy: Fair enough, removed d/v
John Dibling