Inheritance and Pandas

I am trying to create a file writer based on Pandas' ExcelWriter. I proceeded as I usually do with classes in Python (3) with inheritance: import pandas as pd class Writer(pd.ExcelWriter): def __init__(self, fname, engine='openpyxl'): p...
more »

2017-10-03 15:10 (1) Answers

Inheritance with a variable in java

Can anyone clarify me. Here instance method is overridden but variable is not. output is: B 10 class A{ int i=10; public void name(){ System.out.println("A"); } } class B extends A{ int i=20; public void name(){ ...
more »

2017-09-28 11:09 (3) Answers

Confusion in using Super in Python

I am getting an error for the program: class TennisPlayer(): def __init__(self, rank): self.rank = rank def slogan(self): print("What Slogan!") class GrandSlamWinner(TennisPlayer): def __init__(self, rank=0, slams=0): ...
more »

2017-09-22 22:09 (1) Answers

Swift 4 generic, referencing self

I'm considering the following structure using Swift 4: class BaseClass { // abstract function func doSomething<T: BaseClass>(with object: T) {} } class SubClass: BaseClass { var title: String = "hello world" // implementat...
more »

2017-09-20 05:09 (0) Answers

Kotlin inheritance with generics

I have an abstract class, let's call it A. abstract class A(private val name: String) { fun read(key: String): Entity { ... } fun write(entity: Entity) { ... } abstract val mapper: Mapper<Any> ... ...
more »

2017-09-19 18:09 (1) Answers

Casting Generic base object to derived type

What is the correct way to cast a base class that is using generics back to its derived type? I have the following object implemented. Note that the "Save" method is calling the "WriteSettings" method here (takes in a BaseSettings object) public...
more »

2017-09-15 21:09 (1) Answers

Swift protocol specializing generic protocol

Is it possible to have a protocol that specializes a generic protocol? I want something like this: protocol Protocol: RawRepresentable { typealias RawValue = Int ... } This does compile, but when I try to access the init or rawValue from a Pro...
more »

2017-09-14 18:09 (1) Answers

Swift generic inheritance

I have one base view controller and some child view controllers. I am having difficulty to pass the view model created in children view controller (CommentViewController) to it's parent view controller (FeedBaseViewController) to access. class BaseV...
more »

2017-09-08 10:09 (1) Answers

Kotlin override fun with subtype

Im having trouble inheriting an interface containing a method/fun of a base type, that i would like to override as a subtype in the class implementing it. So far i have the interface interface IModel { fun convert(dataModel: BaseDataModel) } ...
more »

2017-09-07 22:09 (2) Answers

Inheritance and Polymorphism in REST API Modeling

I have an object hierarchy that I want to expose through a REST API, and I want to discuss best practices. I have seen this question asked before (e.g. here at the end, here, here, and especially here), but never really any conclusions arrived at. ...
more »

2017-09-07 01:09 (1) Answers

python 3 class inheritance issue

class A(object): def __init__(self): self.a = 1 class B(A): def __init__(self): A.__init__(self) self.a = 2 self.b = 3 class C(object): def __init__(self): self.a = 4 self.c = 5 class D(...
more »

2017-09-05 22:09 (1) Answers