Why some function are class-less?
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Nov 17 08:46:37 PST 2016
On 11/17/16 11:28 AM, Suliman wrote:
> There is some functions that can be called without creation of class.
> For example: http://vibed.org/api/vibe.core.log/
>
> As I understand I can create write log in two way. First create instance
> of Logger, second simply call function.
>
> Why it's done so? Just as shortcut? But is I create class it's look very
> poor http://vibed.org/api/vibe.core.log/FileLogger and I have only one
> needed method: ` put Writes part of a log line message. `
D does not require classes to write functions. All a class member
function is anyway is a function with an implied class instance parameter.
-Steve
More information about the Digitalmars-d-learn
mailing list