AlinPaul8806
AlinPaul8806

Reputation: 417

Compiler throwing error as variable is not declared X++

I have the following piece of x++ code:

static void Datatypes_class_variable(Args _args)
{
    // Declare a class variable from the RentalInfo class
    RentalInfo   rentalInfo;
    ;
    // An object is created and referenced by the
    // class variable rentalInfo
    rentalInfo = new RentalInfo();
    // Call methods to set/get data to/from the object
    rentalInfo.setCar("BMW 320");
    info(strfmt("The car is a %1", rentalInfo.getCar()));
}

I don't understand why the compiler is throwing me the error:

The RentalInfo variable was not declared.

As you can see, the variable has been already declared at the beginning. Thank you!

Upvotes: 0

Views: 1395

Answers (1)

Jan B. Kjeldsen
Jan B. Kjeldsen

Reputation: 18051

The type RentalInfo does not exist as a class.

That is why the error is in line 4 column 4.

Upvotes: 0

Related Questions