inheritance tag

29 questions


2 answers
107 views
0
I have a question about interface extension in Java.(Design Pattern)

I think it's a question about the design pattern ^^In situations where multiple classes implement a single interface, If you need to create a new implementation in a particular class (add a new method...


1 answers
138 views
0
Why does an object inherit?

Why do you inherit an object by writing (object) after its name when declaring a class?Is there a difference that some codes use that and others don't?class MyClass(object): # Class code


1 answers
62 views
0
How do I determine the class of an object?

If you have classes B and C, both of these inherited A, and when you created an object of B or C, how do you know what class this instantiated?

2 years ago

1 answers
113 views
0
the need for multiple inheritance

Hi, everyone.I'm writing to learn more about multiple inheritance.Is it necessary to use multiple inheritance, or is it okay to use it in combination with generics if necessary?It's thisCan anyone exp...

2 years ago

1 answers
94 views
0
JAVA beginner's question. Why is the result zero?

package Calc;import java.util.Scanner;class Calculator{ int a,b; void setOprands(int a,int b) { this.a = a; this.b = b; } int sum() { return this.a+this.b; } void plus() { } void minus() { } void r...

2 years ago

1 answers
130 views
0
How do I call a parent class function in a child class?

Is there a way to call a member function of a parent class in a child class?How can I implement call_print_in_Base below?class Base{public: void print() { cout << i'm base! << endl; }};cla...

2 years ago

3 answers
104 views
0
Simple class inheritance question

It's a simple question.class CObj{ virtual int Add();};class CUnit :public CObjs{ virtual int Add(); virtual void Check();};If there is a simple inheritance structure as follows:Can I normally access ...

2 years ago

1 answers
83 views
0
Is List a subclass of List? Why is Java generic implicitly not guaranteed polymorphism?

It's confusing how Java Generics deals with inheritance and polymorphism.Let's say there's a hierarchy like this.Animal (Parent)Dog - Cat (child) Assuming that there is a DoSomething(List<Animal>...


1 answers
138 views
0
(Python3) What is the difference between super() and super(A, self)?

class A: def __init__(self): print(A)class B(A): def __init__(self): super().__init__()b = B()class A: def __init__(self): print(A)class B(A): def __init__(self): super(B, self).__init__()b = B()T...

2 years ago

1 answers
111 views
0
What is an easy way to create an exception handling class in Java?

You are about to create an exception handling class. public class MyException extends Exception {}public class Foo { public bar() throws MyException { throw new MyException(try again please); }}I trie...

2 years ago
« - 2 - »

© 2024 OneMinuteCode. All rights reserved.