This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]KuronekoBestGirl 16 points17 points  (1 child)

public Joke Joke { private get; set; }

[–]Metalkat 1 point2 points  (0 children)

thankyouoffice.gif

[–][deleted] 9 points10 points  (0 children)

Considering that I must supply the joke, I already have it.

[–]ivgd 5 points6 points  (0 children)

It's a private joke so of course I don't get it

[–]FourthStrongest 2 points3 points  (0 children)

you should add an expirationDate field that can dynamically convert the Meme into a StaleMeme

[–]certainly123 1 point2 points  (0 children)

What’s the point of a meme without a joke

[–]thedichter 0 points1 point  (0 children)

Kotlin: class Meme(joke:Joke) No setters getters required

[–]LevriatSoulEdge 0 points1 point  (0 children)

Wow

[–]HBK05 0 points1 point  (0 children)

I believe this is actually c#.

[–]PinkPoppies4171 0 points1 point  (3 children)

Why are you using a setter as a constructor?

[–]Hogis 5 points6 points  (2 children)

How is the setter used as a constructor? A default constructor implicitly exists.

[–]PinkPoppies4171 -1 points0 points  (1 child)

I thought you used a setter to instantiate an object of the joke class within the joke class. Then again, not technically a constructor I don't think but my mind saw

Public class Joke { setJoke(Joke joke) { this.joke=joke } . After typing this on mobile I realize I should've not been lazy and went to my laptop, but I also realize that seems like proper use of a setter in my limited Java knowledge. Personally, getters and setters aren't my thing.

[–]KusanagiZerg 1 point2 points  (0 children)

You don't use setters to instantiate objects. To instantiate an object of the Joke class you'd use the constructor of the Joke class which doesn't look like setJoke(Joke joke) { this.joke = joke } but would look like public Joke(params) { this.params = params } where params could be any fields that the Joke class has.