Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Foo {
- /* constructors, fields, method, logic and what-not */
- }
- public class Bar extends Foo {
- /* nothing here but constructors */
- }
- public class Bar {
- private Foo foo;
- /* constructors and a bunch of wrapper methods that call
- into foo */
- }
- public class Foo {
- /* constructors, fields, method, logic and what-not */
- private boolean isABar; // Could be an enum
- }
- if (foo instanceof Bar) {
- // Do Bar-specific things
- }
- class Bar extends AbstractFoo {
- public void specialOp() {
- // Do Bar-specific things
- }
- }
- // ...
- foo.specialOp();
- class FooBarImplementation
- {
- public void doSomething() { /* etc. */ }
- /* etc. */
- }
- class Foo inherits FooBarImplementation { /* etc. */ }
- class Bar inherits FooBarImplementation { /* etc. */ }
- class FooBarImplementation
- {
- public void doSomething() { /* etc. */ }
- /* etc. */
- }
- class Foo
- {
- private FooBarImplementation fooBarImplementation = new FooBarImplementation() ;
- public void doSomething() { this.fooBarImplementation.doSomething() ; }
- /* etc. */
- }
- class Bar
- {
- private FooBarImplementation fooBarImplementation = new FooBarImplementation() ;
- public void doSomething() { this.fooBarImplementation.doSomething() ; }
- /* etc. */
- }
- Class MainStuff;
- Class TypeA;
- Class TypeB;
Add Comment
Please, Sign In to add comment