Created
September 9, 2022 16:59
-
-
Save vishalratna-microsoft/4a8817e8cdf31816813ed47cc47c2f48 to your computer and use it in GitHub Desktop.
Submission of work is easy if work is submitted alone.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.tutorials.vishal; | |
import com.tutorials.vishal.hierarchy.BaseWork; | |
import com.tutorials.vishal.hierarchy.RxWork; | |
import com.tutorials.vishal.hierarchy.Scheduler; | |
public class DemoClass { | |
void driver() { | |
BaseWork work = new BaseWork(); | |
RxWork rxWork = new RxWork(); | |
// We are able to submit all types of work. Yay! | |
startJob(work); // Valid! | |
startJob(rxWork); // Valid, polymorphism magic. | |
} | |
void startJob(BaseWork incomingWork) { | |
// validate the work and submit. | |
Scheduler.submit(incomingWork); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment