superclass Questions
4
Solved
Say I have a super class "Animal" and subclasses "Cat", Dog, Bird". Is there a way to have an array of subclass type rather than class instances with which I'll be able to instantiate instances of ...
Knighterrant asked 19/7, 2013 at 3:0
6
Solved
I have a super class with a method that calls other methods that are only defined in its sub classes. That's why, when I create an instance of my super class and call its method, it cannot find the...
Fool asked 3/11, 2011 at 0:37
6
Solved
I was reading 'Dive Into Python' and in the chapter on classes it gives this example:
class FileInfo(UserDict):
"store file metadata"
def __init__(self, filename=None):
UserDict.__init__(self)
...
Lp asked 15/4, 2009 at 20:45
6
Solved
I am working on a project and i am getting the error "implicit super constructor Person() is undefined. Must explicitly invoke another constructor" and i don't quite understand it.
Here is my pers...
Sisyphus asked 30/4, 2014 at 18:31
5
Example #2 from PHP manual http://php.net/manual/en/language.oop5.traits.php states
<?php
class Base {
public function sayHello() {
echo 'Hello ';
}
}
trait SayWorld {
public function sayH...
Knee asked 21/10, 2012 at 21:58
7
Solved
How do I call a super constructor in Dart? Is it possible to call named super constructors?
Mascara asked 7/11, 2012 at 14:46
3
Solved
When I call a method that was overrided from my constructor, I am getting an error and it says that it is missing an argument (due to the subclass requiring a second argument). However, I called th...
Subsidiary asked 14/3, 2018 at 2:7
8
Solved
I'm dealing with a class which extends JFrame.
It's not my code and it makes a call to super before it begins constructing the GUI. I'm wondering why this is done since I've always just accessed t...
Ulna asked 8/5, 2012 at 23:52
11
Solved
Why did the Python designers decide that subclasses' __init__() methods don't automatically call the __init__() methods of their superclasses, as in some other languages? Is the Pythonic and recomm...
Repetitious asked 23/9, 2010 at 21:56
5
I'm debugging a C++ program with GDB.
I have a pointer to an object of certain class. The pointer is declared to be of some super class which is extended by several sub-classes.
There is no field...
Recreate asked 16/12, 2011 at 1:59
1
So we are doing a Virtual Pet project and we need to make ArrayLists and interact with the virtual pets.
What I want to do is have a PetClass superclass that extends to CatClass and DogClass.
CatCl...
Steamtight asked 4/2, 2022 at 1:16
3
Solved
I have a class that extends a base class. Upon instantiation, I want to check if the subclass has one of the classes implemented from its base, but I'm not sure the best way. hasattr(self, '[method...
Toot asked 15/9, 2021 at 1:44
6
Solved
I've found that I can do it this way in the child class:
ParentClass.variable = value;
But I've been told that it's better practice to use get/set methods and not give direct access to variables...
Trolly asked 29/10, 2013 at 18:44
2
Solved
I'm quite new to Flutter and Dart, and I have some troubles understanding how to rewrite a class extending an updated version of Equatable.
This works with Equatable 0.4.0:
abstract class Failure e...
Creaky asked 16/1, 2020 at 14:51
7
Solved
Lets suppose I have the following two classes
public class alpha {
public alpha(){
//some logic
}
public void alphaMethod1(){
//some logic
}
}
public class beta extends alpha {
public b...
Tenace asked 1/8, 2011 at 9:30
2
Solved
The code is this:
class Main {
public static void main(String args[]) {
Person p1 = new Student();
Person p3 = new Teacher();
Student p4 = new Student();
OnlineLecture lec3 = new OnlineLectu...
Petrify asked 11/2, 2021 at 16:56
0
I understand the use of super() to inherit attributes and methods from a class when initializing your class. However, when using this in the context of neural networks such as:
class Net(nn.Module)...
Krystlekrystyna asked 6/12, 2020 at 21:54
4
How can I call base class' constructor after I've called my own constructor?
The problem is, base class' constructor calls an abstract method (overridden in sub class), which needs to access varia...
Zoniazoning asked 28/1, 2013 at 13:10
5
Solved
I want to serialize a POJO class which is not under my control, but want to avoid serializing any of the properties which are coming from the superclass, and not from the final class. Example:
pub...
Alluvium asked 15/11, 2014 at 11:57
13
Solved
Anytime I have to re-import my projects into Eclipse (if I reinstalled Eclipse, or changed the location of the projects), almost all of my overridden methods are not formatted correctly, causing th...
Rigobertorigor asked 5/11, 2009 at 3:17
8
I have two classes:
public class A {
public Object method() {...}
}
public class B extends A {
@Override
public Object method() {...}
}
I have an instance of B. How do I call A.method() from...
Christianity asked 23/3, 2011 at 20:48
2
Solved
I'm writing a Unit test for a class that has an abstract superclass, and one of the functions in the ChildClass is calling a method on an object form the BaseClass.
ChildClass looks something like...
Mountfort asked 3/6, 2020 at 10:53
4
Solved
I'm using Java 7 and got 3 classes:
TestSuper.java
public abstract class TestSuper {
public TestSuper() {
testMethod();
}
protected abstract void testMethod();
}
TestNull.java
public clas...
Northrop asked 20/6, 2014 at 12:57
2
Solved
I'm trying to dynamically create a class using type() and assign an __init__ constructor which calls super().__init__(...); however, when super() gets called I receive the following error:
TypeErr...
Epiblast asked 7/12, 2015 at 20:46
6
Solved
I am really having a tough time understanding the wild card parameter. I have a few questions regarding that.
? as a type parameter can only be used in methods. eg: printAll(MyList<? extends ...
Atilt asked 5/11, 2013 at 18:4
1 Next >
© 2022 - 2025 — McMap. All rights reserved.