Questions tagged [super]

super is a keyword or function used to access/invoke members and constructors of a superclass. Since different languages have such a feature, please use in combination with a language tag.

In Object Oriented programming, super is commonly used keyword to allow access to the members of the superclass from a derived class. It can also be used to select which superclass' constructor to execute when a subclass is created.

Although the concept is prevalent in many object oriented languages, every language has different usages for the keyword.

A few of the basic questions on super in different languages:

A superclass is also called base-class or parent-class and some languages use such keywords instead of super.

1757 questions
0
votes
2 answers

super dealloc error using multiple table view classes

I am new to Iphone apps and I am trying to build a tab based app. I am attempting to have a table ontop of an image in both tabs. On tab with a table of audio links and the other tab with a table of video links. This has all gone swimmingly, I have…
padatronic
  • 98
  • 2
  • 5
0
votes
2 answers

Calling protected constructor of base class from different package using super keyword

How to call constructor of base class in one package which has protected access modifier from a derived in another package? Like this: Package that contains Derived class: package MainPack; import mypack.Checker; import java.util.Scanner; public…
Malwinder Singh
  • 6,644
  • 14
  • 65
  • 103
0
votes
5 answers

Inheritance super variables

I'm writing a simple program in which I have a super class Person inherited by the sub-classes Customer and Employee (they inherit the variables ID, name and surname). public class Person { int id; String name; String surname; …
Logan
  • 267
  • 3
  • 8
  • 18
0
votes
1 answer

How does this subclass instantiate itself?

I'm looking at some code from a pod called PKRevealController that appears odd to me. The pod defines a subclass of CABasicAnimation called PKAnimation: @interface PKAnimation : CABasicAnimation Then it has a factory method in the…
imw
  • 13
  • 4
0
votes
1 answer

How to call super method in interface instance?

@Override public void onBackPressed() { // ... dialog.setPositiveButton(getText(R.string.yes), new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { …
Gintas_
  • 4,940
  • 12
  • 44
  • 87
0
votes
3 answers

How do I call the parent method of a class inside completely non-related class?

I want to use the superclass to call the parent method of a class while using a different class. Class AI(): ... for i in self.initial_computer_group: if i.rect.x == current_coords[0] and i.rect. y== current_coords[1]: …
83457
  • 203
  • 1
  • 11
0
votes
4 answers

Questions about Java constructor, for class and its super class

I'm trying to figure out how the constructors work in the following program. Basically there is a Seeker class that extends Player class, and a Game class that contains Seeker object, as shown in the code below. My question is, when the Game class…
user3735871
  • 527
  • 2
  • 14
  • 31
0
votes
1 answer

mysql #1045 - Access denied in online server for GRANT SUPER

I have a online server with phpmyadmin. i want to use events, but i can't.
Quim Serra
  • 67
  • 8
0
votes
4 answers

Ruby - Can I choose a location to put some code in a method inherited with Super?

I will put here an example: class A def go(name = "girls") print "hello " print name puts " !" end end class B < A def go super("boys") end end A.new.go B.new.go result: hello girls ! hello boys…
Kerollmops
  • 303
  • 4
  • 15
0
votes
3 answers

How do I get parameters from the superclass?

Ok so I have this class Insurance and its constructor. public class Insurance { protected String pNum, pDate; protected int yPrem; public Insurance(String pNum, String pDate, int yPrem) { this.pNum = pNum; this.pDate = pDate; this.yPrem…
ReiHinoX
  • 51
  • 1
  • 13
0
votes
5 answers

Invoke a method on all subclasses from superclass?

I have recently stubled upon something that has always annoyed me. Whenever I want a method to be invoked in all classes that have a certain interface, or if they are extensions, I would like to have a keyword that does the opposite of the keyword…
Seal
  • 11
  • 4
0
votes
0 answers

super keyword in generics

Set setOfAllSuperTypeOfTreeMap = new HashSet(); SortedMap sm = new TreeMap(); TreeMap tm = new TreeMap(); setOfAllSuperTypeOfTreeMap.add(sm); //???I do…
Paul
  • 608
  • 1
  • 9
  • 23
0
votes
2 answers

how to write __init__ in python multiple inheritance to instantiate all variables

class FakeBase(object): def __init__(self, *args): pass class Parent(FakeBase): def __init__(self, x=1, *args): super().__init__(x, *args) self.var1 = x class Parent2(FakeBase): def __init__(self, x=3, y=4,…
user1947415
  • 933
  • 4
  • 14
  • 31
0
votes
2 answers

what happens if the argument structure for a subclass constructor call does not match it's superclass constructor

If you have a subclass and your subclass only constructor is super(int x, int y) but that argument structure does not match any of it's superclass constructor's argument structure, what happens at that point? How does the subclass invoke it's…
Jessica M.
  • 1,451
  • 12
  • 39
  • 54
0
votes
4 answers

Super() python not working for subclass tkinter

So I have a class, Application, with 2 subclasses MyButton and MyLabel. Application also has self.backgroundcolor = 'orange' self.textcolor = 'black' I want to use these two variables in my subclasses MyButton and MyLabel. So, I tried class…
Kevin
  • 708
  • 2
  • 9
  • 20
1 2 3
99
100