{$MODE OBJFPC} //directive to be used for creating classes
{$M+} //directive that allows class constructors and destructors
constructor Create(t : String; p: real); //default constructor
procedure setTitle(t : String); //sets title for a book
function getTitle() : String; //retrieves title
procedure setPrice(p : real); //sets price for a book
function getPrice() : real; //retrieves price
procedure Display(); // display details of a book
physics, chemistry, maths: Books;
constructor Books.Create(t : String; p: real);
procedure Books.setTitle(t : String); //sets title for a book
function Books.getTitle() : String; //retrieves title
procedure Books.setPrice(p : real); //sets price for a book
function Books.getPrice() : real; //retrieves price
procedure Books.Display();
writeln('Title: ', title);
writeln('Price: ', price:5:2);
physics := Books.Create('Physics for High School', 10);
chemistry := Books.Create('Advanced Chemistry', 15);
maths := Books.Create('Algebra', 7);