наследование

How to create a constructor in the descendant with parameters that do not match the parameters of the base constructor

There is a constructor in the base class public Kons(int a, string b){} You need to make a constructor in the heir public ... c):base(a,b){} Writes that the non-static field b requires a reference to the object. You can't make b static. What to do?

Implicit call to the copy constructor

#include <iostream> struct A { A() { std::cout << 'A'; } A(const A&) { std::cout << 'a'; } }; ... the program output ABAb And not what I expected ABab Why did the developers of the standard decide to set this behavior?

The difference and correctness of using abstract classes from interfaces in Java

I'm trying to understand how these two elements differ. I read here and here, as well as the lecture I am studying. If I unde ... d move (int n, int m)? PS PS PS: Sorry for the large number of questions. I just would like to fully understand this topic)

Python, class inheritance

Hey, Stack. Faced with such a problem that I can not correctly distribute the classes into separate ones .py files. According ... : # арккотангенс ... fourth.py class D(): # Вообще это класс для производной, но не знаю от чего его наследовать. ...

Method inheritance in C++

I want to implement the Vector class as an entity of a linear space, and then inherit the usual DoubleVector and Matrix from ... peration is not defined, so the code will drop. Question: is it possible to solve this problem without rewriting the methods?

Creating a superclass object in Java

Please explain why the subclass and superclass constructor is called when creating a superclass object. public class Main { ... "is Person"); } } public class Student extends Person{ Student(){ System.out.println("is Student"); } }

Why add super () to the constructor of a child class if the compiler does it automatically?

Why add the super() call to the child class constructor if the compiler does it automatically? I mean, in any case, the constructor of the parent class will be executed first, and only then the child class, so why write it manually?

java polymorphism

Using a child class as a parent class An important aspect of polymorphism is the ability to use an object of a child cla ... the times I ask this question, and preferably an example, and a good article and a task on the topic of polymorphism. Thanks.

Calling the init method for multiple inheritance

I'm studying multiple inheritance. I don't understand why in one case the init method of both parents is called, and in the o ... y one init is triggered, and in the other case all possible inits are triggered. Thank you in advance for your explanations.

Arrays and inheritance in c++

I'm studying c++, I ran into a problem. There is an Animals class. It has two derived classes Cat and Dog. How to make an arr ... t;name = ""; } }; int main() { Animals anm[10]; anm[0]=Cat(); anm[1]=Dog(); std::cout<<anm[1].age; }

C++programming. Class hierarchy

Hello everyone. I can't figure out what the hitch is. Task: You need to build a hierarchy of classes according to the inherit ... ерархии класса D4\n"; temp1.show_D4(); getch(); return 0; } Who can, help and write the correct code, very much help me out.

How does the Object class differ from other parent classes?

There are classes: class Monster{ //Родительский класс public void eat(){ System.out.println("Есть всё ... uting this program, we get the following result: But why, if you use the Objekt class as the parent class, nothing happens?

What is the java substitute for multiple inheritance?

I want to implement approximately the following architecture: Explanation: Base - Something like a storage entity that sto ... .out.println(MixIn.get_0()); // Итоговое использование должно быть таким System.out.println(MixIn.get_1()); } }

UML: the difference between black and white diamonds when inheriting a class in diagrams

Please tell me, what is the difference between black and white diamonds when inheriting a class in UML diagrams?

PHP Example of inheritance

There is a parent class: class Indexcontent { var $indexcontenttpl; var $filename; function Gethtml($filename) { $indexc ... P.S. Removed underscores from the names of functions, classes, and variables - because the markup tries to recognize italics.

Error: CS7036 Missing argument corresponding to the required formal parameter

What's wrong with my code? I looked at different solutions, but I didn't understand. Missing argument, "name" from " Drone.Dr ... ine(VehicleId + " with " + Name + " has " + PowerScore + " and carrys weapon " + Weapon + " engine " + EngenePower); } }

Multiple inheritance in python

I have a class system like this class C: def __init__(self): print('c') class A: def __init__(self): ... bled: C B A Do you really need to initialize the second parent class with your hands and call its constructor? Why is that?

Prototype inheritance | / JavaScript

To consolidate this topic, I decided to look at the guides/read articles and write the code function Animal(name, age) { th ... ve a constructor like Animal, but it is not completely clear what problems can be caused by the absence of this line of code.

Prototype and proto what is it all about?

I came across this picture: The picture shows that we have some kind of function(I understand the constructor, here I would ... ype. The question is difficult to formulate, because I do not understand what these 2 different prototypes are. Can you chew?