Questions tagged [subtype]
198 questions
0
votes
2 answers
Error: Invalid override in ==
The following error:
ERROR: Invalid override. The type of Bar.== ((Bar) → bool) is not a subtype of
Foo.== ((Foo) → bool).
Occurs in line 10 of the following code (v1.15.0):
1 class Foo {
2 int foo;
3 Foo(this.foo);
4 bool operator…
![](../../users/profiles/5664590.webp)
jfp
- 221
- 1
- 2
- 6
0
votes
0 answers
How can I deal with sub type in Java?
Hi this is what I've got in the Modula 2 code,
TYPE
TypeA = TypeB;
PROCEDURE Extend(Var: TypeA): TypeA;
BEGIN
RETURN Varrr: TypeA;
END Extend;
So I already have a type B, now I need to make it a new type called type A, so all type A is type…
![](../../users/profiles/6080013.webp)
Anda Zhao
- 51
- 9
0
votes
2 answers
Why would somebody cast instead of returning a subtype
When overriding an inherited method, is there any reason to not declare the type a sub-type of of its original type? (Animal instead of Bunny see below)
Here is an example with bunnies.
public class Junk2 {
public static abstract class Animal…
![](../../users/profiles/4033292.webp)
Derrops
- 5,723
- 4
- 21
- 43
0
votes
1 answer
VHDL: How to assign "integer range 0 to 99" as a new type name like typedef is used in C++
This is what I am trying to do in VHDL:
type score is integer range 0 to 99;
type speed is integer range 0 to 99;
But I think I have fundamentally misunderstood how "type" works in VHDL as the tool is generating error. It says near "integer":…
![](../../users/profiles/854183.webp)
quantum231
- 1,927
- 3
- 24
- 45
0
votes
0 answers
How to define a subtype in SQL?
I'm trying to define a subtype but I have no idea how, I've googled it but I didn't find anything concrete.
What I'm trying to do is build a netflix-like database which has movies and series.
So I have my "supertable" called "images" (didn't know…
![](../../users/profiles/5682153.webp)
Bram-N
- 306
- 2
- 13
0
votes
2 answers
calling method with list of subtype without casting
The Call
List subList1 = new List();
List subList2 = new List();
FuzzyCompareCollection(subList1,subList2); //Compile Error
How i could do…
![](../../users/profiles/5436850.webp)
FreeG
- 95
- 1
- 8
0
votes
1 answer
Ada "Subtype mark required"
I was given a project at uni where I need to write an ADA package of a graph. The points of the graph are stored in an array, the edges are stored in a matrix.(In the matrix if there is an edge between two points the number at that index is the…
![](../../users/profiles/5510385.webp)
Dorrektor125
- 1
- 1
0
votes
1 answer
Scala Inheritance of Type Constructor
Right now, I am trying to implement a variant of a Linked List with the following code, but I am having trouble with it. Basically, I am trying to create different type of nodes that will connect with each other by the next method. Thus, I have two…
![](../../users/profiles/1910822.webp)
mtber75
- 858
- 1
- 7
- 15
0
votes
1 answer
Is the use of a type where its range-restricted subtype is expected considered correct in Ada?
According to slide 28 of
https://github.com/AdaCoreU/Courses/blob/master/lectures/03_Programming_in_the_Large/02_Type_Safety/slides/Strong_Typing.ppt?raw=true
the below code is correct, because
"T is a subtype of Integer. Therefore, V1 and V2 are of…
![](../../users/profiles/4849326.webp)
dzrubtdp
- 1
0
votes
2 answers
Applying properties of a base type to a subtype in JavaScript
I would like to include the properties and initialization logic from a "base" type into a "sub" type in JavaScript. Is the following idiomatic?
function Base(arg1) {
this.foo = arg1.foo;
}
function Sub(arg1) {
//Initialize using the base…
![](../../users/profiles/38522.webp)
Ben Aston
- 45,997
- 54
- 176
- 303
0
votes
1 answer
Swift - Character is not a subtype of string
myText = "word 1 / word 2"
var testVar = split(myText, { $0 == "/"}, maxSplit: Int.max, allowEmptySlices: false)
This code works but it takes empty space "word 1 " when I use testVar[0]
when I write empty spaces
var testVar = split(myText, { $0…
![](../../users/profiles/2835794.webp)
Bogdan Bogdanov
- 902
- 8
- 34
- 69
0
votes
1 answer
Oracle SQL classify Subtype
CREATE TABLE Customer
(
CustomerID NUMBER NOT NULL,
AccountID NUMBER(10) NOT NULL,
CustomerType VARCHAR(10) NOT NULL,
CustomerStatus VARCHAR(10) NOT NULL,
CONSTRAINT customer_pk PRIMARY KEY (CustomerID),
CONSTRAINT check_customer_status…
![](../../users/profiles/4153086.webp)
pooch
- 3
- 1
- 4
0
votes
1 answer
array type required in indexed component ADA
Alright, so i'm writing a program that's designed to compare 7 digit inputs to a known set of seven digit inputs and find the distances between them. Everything compiles fine except for the fact that I'm getting an error that states that "array type…
![](../../users/profiles/2844837.webp)
Iccirrus
- 11
- 1
- 2
- 4
0
votes
2 answers
Is it possible to create an error and assign it to an error subtype variable in VBScript?
Theoretically, if VarType(foo) returns 10 or vbError, it means that foo is an error. Am I wrong?
So how do I force this to happen? Is it even possible to force foo to hold an error? If it's not, then I don't understand why Error is a variable…
![](../../users/profiles/3976036.webp)
Enorma
- 3
- 2
0
votes
1 answer
vhdl convert subtype to type for active hdl
I have a pakcgae in which I declare a bunch of subtypes and types. In Active HDL, there seems to be a problem whenever I try to make a port out of a subtype, so I'm wondering if there is a way to convert them to types instead. The following would be…
![](../../users/profiles/3892365.webp)
Ryan Thorne
- 3
- 1