Can a function return an object of a class?

Hello,
can a function return an object of a class in systemverilog?

In reply to Sunil Bhatt:
A function can return a value of any data type, which includes a class type. The value is actually a reference, or handle to class object.

can anybody tell me function and task inside a module with return data type
in verilog

In reply to baladevi:

function , can return a value , so
you can always do
x= any_function_with_return_value(return_value);
and then use this x in your code, you can check the complete syntax online

Task on other hand , can only return back from the task code, that means , you can always do like this

task
do_something;
if(please_return_dont_execute_anymore == 1)
return ;
do_something2;
endtask

so here in task you can just return back in between , note we cannot return any value though
do_something2 will not execute if please_return_dont_execute_anymore == 1