Questions tagged [supertype]

57 questions
79
votes
6 answers

Cannot reference "X" before supertype constructor has been called, where x is a final variable

Consider the following Java class declaration: public class Test { private final int defaultValue = 10; private int var; public Test() { this(defaultValue); // <-- Compiler error: cannot reference defaultValue before…
Amr Bekhit
  • 4,187
  • 6
  • 29
  • 50
12
votes
5 answers

How do I apply subtypes into an SQL Server database?

I am working on a program in which you can register complaints. There are three types of complaints: internal (errors from employees), external (errors from another company) and supplier (errors made by a supplier). They hold different data which…
Fusyion
  • 704
  • 1
  • 11
  • 23
7
votes
6 answers

What is a supertype method?

I have googled couple of times but still can't understand the supertype method. Can anyone please explain what is this?
ray
  • 4,068
  • 7
  • 26
  • 40
6
votes
4 answers

isAnnotationPresent() return false when used with super type reference in Java

I m trying to get the annotation details from super type reference variable using reflection, to make the method accept all sub types. But isAnnotationPresent() returning false. Same with other annotation related methods. If used on the exact type,…
manikanta
  • 7,066
  • 5
  • 52
  • 61
6
votes
3 answers

Why create an abstract super type in Julia?

I am looking at someone code and it uses <: when creating a struct. I looked in the docs and found out that this means they are creating an abstract supertype. Can anyone explain what this is and why one would want to use it?
logankilpatrick
  • 6,130
  • 1
  • 13
  • 52
5
votes
1 answer

When to use super(type) in python?

When can I use super(type)? Not super(type,obj) but super(type) - with one argument.
Ella Sharakanski
  • 2,371
  • 2
  • 22
  • 43
3
votes
1 answer

In common lisp, what is a function that returns the most specific supertype of two objects?

I am most interested in the applicability to SBCL, but am curious about other implementations of Common Lisp as well. In Common Lisp we have the type hierarchy. I would like a function that, given two objects as parameters, returns the symbol…
DJMelksham
  • 163
  • 7
3
votes
1 answer

Casting to subtype in Oracle SQL when using refs

I have a type lecturer_typ with 2 sub types module_leader_typ and external_typ. I have inserted objects of all 3 of these types in one table called lecturer_tbl. I want to insert a reference to a module_leader_typ in another table but it's telling…
Max Carroll
  • 2,773
  • 1
  • 21
  • 24
2
votes
3 answers

How do I create an F# list containing objects with a common superclass?

I have two functions, horizontal and vertical, for laying out controls. They work like this: let verticalList = vertical [new TextBlock(Text = "one"); new TextBlock(Text = "two"); new…
Jules
  • 6,089
  • 1
  • 25
  • 40
2
votes
4 answers

How to prevent entering value in table when primary is used on other table?

I have to construct and populate a supertype-subtype relationship, but I cannot get it to work the way it is supposed to be. Basically PERSON table is the supertype of table STUDENT and TEACHER(subtypes). But a person can be either a student or a…
Loizos Vasileiou
  • 511
  • 2
  • 20
2
votes
1 answer

Java. Why I can't convert a interface object to a class object?

I have this interface: public interface Numeric { public Numeric addition(Numeric x,Numeric y); public Numeric subtraction(Numeric x,Numeric y); } And this class: public class Complex implements Numeric { private int real; private…
user6300260
2
votes
1 answer

Types of argument to be passed to in Java

In Chapter 8 of Generic Types from Core Java Volume I Edition 10, NOTE: Another common use for supertype bounds is an argument type of a functional interface. For example, the Collection interface has a method default boolean…
Holmes Queen
  • 292
  • 1
  • 4
  • 16
2
votes
3 answers

Why is this class not considered a supertype as a parameter?

Given the following example, why am I able to override the return type List as List in getUserList() but cannot do the same for the parameter of setUserList()? Isn't ConfigUser considered a supertype of IConfigUser…
Zhro
  • 2,279
  • 1
  • 18
  • 34
2
votes
2 answers

Parametric methods with different subtypes

today in Theory of Programming Language class we have seen this behaviour in Java: public class Es { ... Y choose(Y y1, Y y2){ Y returnVal; if("some test"){ returnVal = y1;} else{ returnVal = y2;} return…
Francesco Pegoraro
  • 708
  • 10
  • 27
2
votes
1 answer

Update Trigger : Supertype/subtypes tables

I need some help about triggers. I’m currently developing a platform and a database in order to manage exams at my university. Here is my problem: I have 1 supertype table, which contains all the persons registered on the platform. I have to be able…
1
2 3 4