Hey,
i googled around for a solution but seem unable to come up with a reasonable solution to the problem of passing a class as a parameter. I wish to mimic the syntax used in java like below :
setPenColor(new Color(255, 0, 255));
Where i can pass a new object as a parameter, however since no constructor has a return type, and if i use something like :
//output returns a hex string, part of RGBColor class
public String getOutput()
{
return output;
}
//the add function in the pen class
public int add(String c) {
System.out.print(c);
return 0;
}
pen.add(new RGBColor(233,233,233).getoutput);
Then it returns a null object, can anyone link me or explain a way to pass a new instance without previously instantiating an object or without refering a specific type to the add function please :)