Having member function name same as structure name

What is this means to be in structure

struct book
{
  function book($name, $price)
  {
    name = $name;
    price = $price;
  }
}
$Book = new book("ANSI C", 218.00);

Regardless of language used in the code either it is in PHP or C, what is the meaning of code.
It seems to be the code will assign the name and price of the book to structure, but if so, what it should be called…Constructor? I don’t know about this, but I think constructor is concept of OOPs and structure comes before OOPs


Source: oop

Leave a Reply