Dear Statalist,

I have one question regarding the mata programming. I couldn't figure out why mata reports an error "type mismatch: exp.exp: transmorphic found where struct expected" when it goes to codes
Code:
AA.aa = sum(A1.a)
for function -myfct2-.

Kind regards,
Yugen

Code:
mata:

mata clear

//-------------------------------------------------
class Myclass1 {    
    
    real vector a
    
}

class Myclass1 scalar myfct1 (real vector b)  {
    
    class Myclass1 scalar A

    A.a = b

    return(A)
}

//-------------------------------------------------

class Myclass2  {

    real scalar aa

}

class Myclass2 scalar myfct2 (real vector b)  {
    
    class Myclass2 scalar AA
    
    A1=myfct1(b)
    
    AA.aa = sum(A1.a)
    
    return(AA)
    
    
}


end