Inheritance / Polymorphism
See original GitHub issueA highly request feature is polymorphism. Mostly for use in ListAdapters, but a lot of other scenarios exists.
We need support for the following:
- Abstract RealmObject classes
- Query support
Example
public abstract Animal extends RealmObject {
private String name;
}
public class Dog extends Animal {
private boolean willPlayCatch;
}
public class Spider extends Animal {
private boolean isScary;
}
// Following should be possible
RealmResults<Animal> animals = realm.where(Animal.class).equalsTo("name","Foo").findAll();
String name = animals.get(0).getName();
RealmResults<Dog> dogs = realm.where(Dog.class).equalsTo("name","Foo").and().equalsTo("willPlayCatch", true).findAll();
String name = dogs.get(0).getName();
Issue Analytics
- State:
- Created 9 years ago
- Reactions:401
- Comments:186 (47 by maintainers)
Top Results From Across the Web
Difference between Inheritance and Polymorphism
1. Inheritance is one in which a new class is created (derived class) that inherits the features from the already existing class(Base class)....
Read more >5.4: Difference between Inheritance and Polymorphism
1. Inheritance is one in which a new class is created (derived class) that inherits the features from the already existing class(Base class)....
Read more >What is the main difference between Inheritance and ...
Polymorphism is an effect of inheritance. It can only happen in classes that extend one another. It allows you to ...
Read more >Polymorphism vs. Inheritance: Difference Between ... - upGrad
Inheritance is essentially making a class, and then having other classes in your program get their feature form the already existing base class....
Read more >Inheritance, Encapsulation and Polymorphism
There are three more important concept, inheritance, which makes the OOP code more modular, easier to reuse and build a relationship between classes....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @T-Spoon We have a couple of other major features we would like to look at first, so we don’t have a timeframe yet, sorry. If inheritance is a dealbreaker for you, you should probably not use us this time around. But we do hope you will come back 😃
Oh come on people, do not just comment “+1”, I know my comment also has no point, but, you could all just subscribe to the thread and wait for an actual valid response from someone from the team. This way you’re not just flooding the issue with unnecessary entries…