Incompatible types at assignment

Hi,
little confused please help in this.

class singleton;
  int len;

  static singleton objSingle;

  local function new (int len);
    this.len = len;
  endfunction : new

  function void print_len ();
    $display("Len is = %d", len);
  endfunction : print_len

  static function create (int len);
    if (objSingle == null) begin
        $display("Object is null creating new object \n");
        objSingle = new(len);
    end

    return objSingle;
  endfunction : create

endclass

module main;

  singleton objSingle1;
  singleton objSingle2;

  initial
  begin
    objSingle1 = singleton::create (0);
    objSingle2 = singleton::create (0);

    $display("Testing Singleton object \n");
    objSingle2.len = 10;
    objSingle1.print_len();   // Call print len function
    objSingle2.print_len();   // Call print len function

    objSingle1.len = 99;
    objSingle1.print_len();   // Call print len function
    objSingle2.print_len();   // Call print len function
  end

endmoudle: main

error: WARNING VCP2814 “Function create should return a value.” “testbench.sv” 18 27
ERROR VCP2852 “Incompatible types at assignment: .objSingle1 ← create(0).” “testbench.sv” 36 39
ERROR VCP2852 “Incompatible types at assignment: .objSingle2 ← create(0).” “testbench.sv” 37 39

In reply to ASICverif:

the function type of create should be singleton, so you can define the function like this:

static function singleton create (int len);
if (objSingle == null) begin
$display("Object is null creating new object \n");
objSingle = new(len);
end

return objSingle;
endfunction : create