Error: no property "someFont" for type int

Marco de Wild via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 10 22:37:42 PST 2015


I'm trying to build a small manga reader application (because why 
search the internet if you can build it yourself), using DSFML. 
However, I'm getting a weird compilation error that I can't 
decrypt.

In directory.d:
using style;
(...)
_text = new Text;
with(_text)
{
     setFont(Style.DirectoryFont);


In style.d:
module style;
(...)
public static class Style
{
     private static Font _font;
     public static Font DirectoryFont()
     {
         if(!(_font is null)) return _font;
         _font = new Font;
         Load(_font); // Helper function that loads the font into 
_font
         return _font;
     }
}

I'm getting the error message that the compiler can't find
source/directory.d(...) : Error: no property 'DirectoryFont' for 
type 'int'.
When I change the line to actually contain the (iirc optional) 
brackets, the type changes to 'Style'. Am I missing something 
with regards to static classes and members in D?
Thanks in advance.


More information about the Digitalmars-d-learn mailing list