What is the difference between 'File.read' and 'IO.read'? What is the difference between 'File.read' and 'IO.read'? ruby ruby

What is the difference between 'File.read' and 'IO.read'?


since File is a subclass of IO and it does not have the read method, when you invoke File.read, you are actually calling IO.readno difference here.


File is a subclass of IO, and File.read is just IO.read (File class doesn't have this method, so when read gets called IO.read is called).