polymorphism Questions
4
Solved
In my current C++-project I have an STL map which maps integer keys onto objects. An algorithm returns a set of entries. The returned data depends on the algorithm's input and hence cannot be predi...
Pincers asked 13/2, 2012 at 14:16
1
So, parent class constructor is called in Java, but not in Python. If that means that parent object is not created, how is call to def function in Python successful - What is happening here?
Pytho...
Polariscope asked 12/4, 2020 at 7:3
3
Solved
I have this case where I am extending from a super class with methods being typed using Generics as the following:
Models
abstract class SuperClass {
//.....
}
class SubClass extends SuperCl...
Hagood asked 19/2, 2020 at 6:25
2
A feature of roles is role groups, which allow you to declare multiple roles with the same name accepting different parameters, similarly to multi routines:
role Foo[Int:D] {
method is-int(::?CLA...
Cellophane asked 27/3, 2020 at 1:42
2
I'm writing a program which parses a number of files. These files can fall into a number of different categories and I don't know which in advance. I makes sense to create a type for each typ...
Gallicize asked 21/2, 2020 at 10:34
14
Solved
Can anyone provide a simple example that explains the difference between Dynamic and Static polymorphism in Java?
Languor asked 26/12, 2013 at 10:30
6
Solved
C# provides following signature characteristics to be used while function overloading.
We know that for overloading takes into consideration only arguments; their number and types, but the object...
Endymion asked 10/9, 2014 at 6:29
3
Solved
Is this code legal?
class Base1 {
};
class Base2 {
public:
virtual ~Base2() {
if (!dynamic_cast<Base1*>(this))
std::cout << "aaaa" << std::endl;
}
Base2() {
}
};
class My...
Peake asked 29/1, 2020 at 18:55
0
I am missing something in the proper use of polymorphism in Open API 3.
In the specification document (3.0.2), an example uses oneOf, and optionally the Discriminator block :
MyResponseType:
...
Overijssel asked 22/1, 2020 at 16:29
6
Solved
I have an object hierarchy I need to expose through a RESTful API and I'm not sure how my URLs should be structured and what they should return. I could not find any best practices.
Let's say I ha...
Dunlop asked 4/6, 2012 at 11:26
2
I have created the following class hierarchy:
open class A {
init {
f()
}
open fun f() {
println("In A f")
}
}
class B : A() {
var x: Int = 33
init {
println("x: " + x)
}
override f...
Kamkama asked 20/1, 2020 at 11:16
4
Solved
I have a base class
public class A
{
public string s1;
public string s2;
}
I also have a derived class :
public class B : A
{
public string s3;
}
Suppose my program created an instance o...
Frostbitten asked 25/12, 2011 at 22:28
1
Solved
Given the following example:
class ProfileTab: Identifiable {
let id = UUID()
let name: String
init(name: String) {
self.name = name
}
}
class ProfileQuoteTab: ProfileTab {
let answer: Str...
Infeasible asked 6/1, 2020 at 5:55
2
I'm trying to get all the Reviews of a User, with their Event.
I have a polymorphic relationship in Review: it can be linked to either an Estimate or an EventDate.
EventDate is directly linked to E...
Budwig asked 19/12, 2019 at 15:36
2
Solved
I am trying to override the size function in Vector_container but the IDE is telling me "Non-virtual member function marked 'override' hides virtual member function"
class Container {
public:
vir...
Railey asked 7/12, 2019 at 16:37
2
Solved
I am watching one of Jeffs Laracast Tutorials about coding rules.
function signUp($subscription)
{
if ($subscription == 'monthly')
{
$this->createMonthlySubscription();
}
elseif ($subscri...
Angelita asked 28/4, 2016 at 11:15
4
Solved
I understand how forall enables us to write polymorphic function.
According to this chapter, the normal function which we generally write are Rank 1 types. And this function is of Rank 2 type:
fo...
Hazel asked 12/3, 2014 at 19:43
3
Solved
I have a base class
class ShapeF
{
public:
ShapeF();
virtual ~ShapeF();
inline void SetPosition(const Vector2& inPosition) { mPosition.Set(inPosition); }
protected:
Vector2 mPosition;
}
...
Suttle asked 31/1, 2013 at 17:32
2
Solved
Hi all I have a doubt regarding templates and polymorphism. By definition polymorphism provides code reusability, and templates in some sense allows the user to use the same code by providing gener...
Felicitasfelicitate asked 11/5, 2012 at 17:19
2
Solved
I always understood class helpers as extension classes, or partial classes. They act like an expand for the code of the original base class. If I copied the interface part of code and add it to the...
Surakarta asked 13/3, 2019 at 14:25
6
Solved
I'm trying to refresh my memory but can't find answers with Google.
public class BaseClass
{
public virtual void DoSomething()
{
Trace.Write("base class");
}
}
public class DerivedClass : Bas...
Acidity asked 30/11, 2011 at 16:35
3
I am having two classes Parent and Child.From Child class I am calling parent overridden method (show).From Parent class, I am calling another method(display) but that method is also overridden due...
Downe asked 12/10, 2016 at 14:54
1
Solved
What I Want to Do
I want to use Jackson to deserialize a polymorphic type, using the standard @JsonTypeInfo annotation as follows:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME,
include = As.EXISTING_...
Kraft asked 24/5, 2016 at 21:3
9
Solved
I'm looking for some way to effectively hide inherited members. I have a library of classes which inherit from common base classes. Some of the more recent descendant classes inherit dependency pro...
Battles asked 4/8, 2008 at 19:13
2
Solved
Two similar definitions in Java and C++, but totally different behaviour.
Java version:
class base{
public void func1(){
func2();
}
public void func2(){
System.out.println(" I am in base:fun...
Inexecution asked 17/6, 2015 at 6:12
© 2022 - 2024 — McMap. All rights reserved.