All Questions
Tagged with overriding class
360 questions
0
votes
0
answers
19
views
Override one method at the class level [duplicate]
I dislike Python's native string for complex numbers, and so wrote my own:
def str (z):
result = f"{z.real}"
if (z.imag < 0.0):
result += " - "
else:
...
0
votes
1
answer
152
views
How to change current date underline color react-dateRangePicker
i want to change the color of current date underline in react.js
i have tried the custom classes its not working to override i want a syntax to over ride react date range picker classes. i have used ...
1
vote
2
answers
194
views
Trying to create a C# program that uses auto-implemented properties, overrides ToString(), and uses a child class
I'm going to try to be as clear as possible, but bear with me.
I need to make a program that:
Create a class named LetterDemo that instantiates objects of two classes (named Letter and Certified ...
0
votes
0
answers
44
views
Why is the paintComponent() method executed without being called?
i am just learning Java , today i ran into a problem while practicing. first, I inherited from JPanel and drew a diagonal line using the paintComponent method. but in the main class of the program, I ...
-1
votes
2
answers
140
views
Out of bounds address when overriding virtual class method in cuda kernel
For the project I'm working on, I have defined a certain base class and several derived classes that inherit it. The base class has several virtual methods that are overriden by methods in the derived ...
0
votes
1
answer
92
views
Access Virtual Function In Interface Directly From Implemented Class
Say I have the following function:
public interface MyInterface
{
int GetNumber();
virtual int GetTwiceNumber()
=> 2 * GetNumber();
}
I can implement the interface in a class as ...
0
votes
1
answer
205
views
Class helper breaks override of virtual method
Consider the following Delphi console app:
program Project1;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils;
type
TC1 = class
procedure m; virtual;
end;
TC2 = class(TC1)
...
-4
votes
1
answer
126
views
Why does this happen when we override the ToString() method in a class?
I created a Person class and overrode some properties and constructor method and override ToString() method.
And I defined another class MyClass<T1> generically and created a field called a and ...
1
vote
2
answers
80
views
range of protected method "subclass" means
Suppose "class A2" and p"ublic class A" are in the A.java file,
and class B is in a different package than A.java.
This is Class B
public class B {
protected void protectedMethod() ...
0
votes
0
answers
37
views
Can I overriden static members (non-static properties and non-static methods)?
With instance members (non-static) I know we can, but with static members I DON'T KNOW IF WE CAN, if we can, is it good practice?
0
votes
1
answer
1k
views
How to override a method and keep its original code in Dart / Flutter?
i'd like to override the method "dispose" by adding a function in it (let's imagine print()), but i'd like to keep its original purpose because otherwise it sometimes throws parent stability ...
0
votes
2
answers
61
views
How does this piece of code work (I think the correct term is 'currying')
I am having a hard time understanding how this code works:
class add(int):
def __call__(self, int):
return add(self + int)
result = add(2)
print(result(4))
The int 2 seems to get ...
-2
votes
1
answer
83
views
default constructor & class pointer, overriding, inheritance problem [closed]
#include <iostream>
using namespace std;
class Base {
int x;
public:
Base() : x() {}
Base(int x) : x(x) {}
virtual void print() const {
cout << x << ...
-1
votes
1
answer
376
views
Can you override a function from a class outside of a class in Python
Can you override a function from a class, like:
class A:
def func():
print("Out of A")
classA = A
# Is something like this possible
def classA.func():
print("Overrided!&...
0
votes
1
answer
124
views
Scala class extends Java class
I'm a little new to this, so sorry if it may seem a naive question. Let's say I have Java class as follows:
public class A {
private final regex = "folder1/folder2/folder3/.*";
...