5 questions from the last 30 days
Advice
0
votes
9
replies
120
views
Why the inherited method output parent's data?
Explain please why the output is "Base" ? Isn't getClassName method inherited?
class Base {
public String className = "Base";
public String getClassName() {
...
3
votes
1
answer
185
views
“The type initializer threw an exception” even though static fields are initialized [duplicate]
I'm getting a TypeInitializationException when running this C# code.
It happens when a constructor tries to add an instance to a static list that should already be initialized.
You can run it here:
...
0
votes
1
answer
128
views
C# .NET extension without extension method [closed]
I have a base class and multiple derived classes:
public class Camera
{
}
public class CameraManufacturerA : Camera
{
}
public class CameraManufacturerB : Camera
{
}
public class ...
Best practices
1
vote
6
replies
217
views
Base class and derived classes in Qt
I'm building a Qt wrapper for RtMidi. As starting point I created two separate classes QMidiOut and QMidiIn that wrap RtMidiOut and RtMidiIn.
I don't want to duplicate code for the common methods (e.g....
-2
votes
0
answers
56
views
On calling inherited method from parent class by object of child class why instance variable of parent class is printed [duplicate]
class parent{
private String x = "Parent";
public void printmsg() {
System.out.println("value is "+ this.x);
}
}
public class child extends parent{
...