Questions tagged [subtype]
198 questions
0
votes
1 answer
Use global type instead of the local subtype with same name
I have a oracle database with several packages and some types. There is a type defined like
create or replace type my_type as table of varchar2(4000)
And then, into pkg_machines there is
subtype my_type is varchar2(4000)
Now, I didn't write the…
![](../../users/profiles/1759845.webp)
BackSlash
- 20,445
- 19
- 77
- 124
0
votes
3 answers
When will scala ever return Any?
I was following the scala course from coursera taught Martin Odersky. He was giving some brilliant examples about return types and one thing puzzled me:
if(true) 1 else false // return AnyVal as this is the closest subtype of both primitive types
I…
![](../../users/profiles/1290607.webp)
Bula
- 1,808
- 4
- 24
- 48
0
votes
2 answers
Equivalence of Array types in Ada
While trying to make an ADA binding to a third party C/C++ library (SAPNWRFCSDK) I came to problems of type inference for array types:
First problem:
The Gnat-Binding-Generator from gcc (gcc -fdump-ada-spec) is generating lots of intermediate named…
![](../../users/profiles/3485675.webp)
Florian B.
- 51
- 6
0
votes
5 answers
(Java) Difference ways of instantiating subclasses
I have these two classes:
public class A {}
public class B extends A {}
In the main class, I would declare:
A a = new B();
B b = new B();
What is the difference between a and b ? Is this what we called a subtyping in java?
![](../../users/profiles/3363317.webp)
Sleeping Beauty
- 59
- 1
- 4
0
votes
1 answer
Select all full records in a supertype/subtype SQL pattern
In a relational supertype/subtype structure where, for example, I have a supertype table entity with an entity_type column and a number of subtype tables, is there any way I can go about querying all entities with their full records, that is somehow…
![](../../users/profiles/389765.webp)
Dan
- 4,582
- 3
- 17
- 26
0
votes
2 answers
java subtype relationship
While reading Horstmann's book, I've encountered this about subtype relationship in Java:
S is a subtype of T if:
S is an array type and T is Cloneable or Serializable
And I couldn't truly understand what this is supposed to mean. Can anyone…
![](../../users/profiles/2233864.webp)
sha1
- 155
- 7
0
votes
1 answer
Android - Determine if LTE on API level 8
I'm using the TelephonyManager on API level 8 to determine the network type and subtype. Though it does not give me an option for LTE, HSPAP, EVDO_8 and EHRPD. They're all available on API level 9+. I want my app to be usable on API level 8+. Can I…
![](../../users/profiles/715888.webp)
Sebastian
- 1,398
- 4
- 23
- 38
0
votes
1 answer
MYSQL - INSERT with SuperType/Subtype and auto increment
Imagine I have the following database structure:
product_id in Products table is Auto-Increment
How can I Insert something in the Products table and either Amazon_Books or Starbucks_Products without losing track of the product_id?
My first…
![](../../users/profiles/1204180.webp)
Cristian
- 1,919
- 3
- 21
- 33
0
votes
1 answer
Build specific class in object graph with Guice
I am stuck in a situation where I decided early on not to create a specific graph with Guice. I need a factory, but I cannot figure out how to build it.
What I have achieved is a session aware game object management system.
All objects that need to…
![](../../users/profiles/1092670.webp)
AnthonyJClink
- 970
- 1
- 10
- 31
0
votes
1 answer
Java polymorphism arrays sub-types to each other
I know that Java is static language, and there is dynamic check when it comes to arrays :
but I can't understand why this happen, can someone explain to me this example in both cases when : A[] is sub-type to B[], or B[] is sub-type to A[] ? which…
![](../../users/profiles/1149570.webp)
nabil
- 874
- 1
- 11
- 28
0
votes
2 answers
Best way to handle creation of large number of subtype objects
I have a base Message class, and around 100 different subtype classes of Message that represent each type of message that can be processed. What I am currently considering doing is using a giant switch statement to create the message object. For…
![](../../users/profiles/643828.webp)
Bob Bryan
- 3,259
- 1
- 27
- 41
0
votes
1 answer
Adding object to a list of supertypes with wildcards
Possible Duplicate:
Understanding wildcards in Java generics
I have a class Car which is extended by Chevrolet. Then you can see quite normal piece of code:
List extends Chevrolet> extededChevrolets = new ArrayList<>();
List extends Car> …
![](../../users/profiles/817474.webp)
mickythump
- 461
- 4
- 5
0
votes
1 answer
Making a given Java class more generic and flexible
I am given a class Shop that maintains a collection of items of type T. It provides buy and sell functions for single or multiple items and uses a List as a container for buying and selling:
import java.util.*;
public class Shop {
List…
![](../../users/profiles/1343118.webp)
norman
- 4,280
- 10
- 38
- 72
0
votes
1 answer
ERD including supertype, subtype database
I'm drawing an ERD for a database and want to know if you need to include the supertypes and sub-types in the ERD. If yes, how to represent it. Thanks.
![](../../users/profiles/1545720.webp)
Cho Dien
- 5
- 3
0
votes
2 answers
Inheritance, does the "is a" relationship always have to hold?
If class B inherits from class A, does class B always have to be a sub-type of A when used in inheritance?
I am thinking if it is possible to use inheritance to provide extra code to B, when B is not a subtype of A?
![](../../users/profiles/1446714.webp)
peroni_santo
- 347
- 1
- 10