I am creating a chat app. In the chat, users can send three types of messages: images, files, and text messages. I am trying to create an interface called IMessege
that contain 3 class properties:
interface IMessege
{
object content { get; }
User sender { get; }
DateTime sent { get; }
}
Then I want to implement the interface in 3 classes: FileMessege
, ImageMessege
and StringMessege
. I want them all to have User sender
and DateTime sent
, but the content
I want to be from type string
at StringMessege
, from type file
at FileMessege
etc...
I did not think this is going to be a problem since all these classes inherit from object
, but apparently it is.
how can I do it?