ооп

how to use the instanceof method correctly

The task is given: Create a static printMagazines(Printable[] printable) method in the Magazine class that outputs only the n ... java.lang.ArrayIndexOutOfBoundsException: Index 3 out of bounds for length 3 at Main.main(Main.java:19) Thank you in advance!

Call a class method in the same python class

I'm teaching oop in python, I ran into an error that I don't understand. I want to call the class method inside of it, but I ... ef __init__(self,name='Alex'): self.name=name def prnt(self): print(self.name) self.prnt() p1=Cat()

Access modifiers in C#

Let's say I set the access modifier internal to the class, and the variable in this class is public. Question, will this variable have an access modifier internal (as a class access modifier) or public (as a variable access modifier)?

Java-class name

Please tell me how to compare the class name with the specified string( the string is entered by the user). Is there any way to write the class name to a string variable?

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)

Virtual destructor

There was a question about the virtual destructor. As far as I understand-a virtual destructor is needed so that in the inhe ... ted class, then you need to create a virtual one. And all this so that there is no memory leak. Did I get the point right?

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"); } }

Java Constructors

Hello everyone! There is a basic constructor: public abstract class JS { public Context context; public JS(Context ... there is no constructor with such parameters... Please tell me why? In other object languages, this works, but not in Java..

Question on OOP non-static variable this cannot be referenced from a static context

Hello everyone, an error occurs: "Error:(6, 21) java: non-static variable this cannot be referenced from a static contex ... t like this: public static class Car Can anyone help explain this problem? Are there any other ways to solve this problem?

OOP in Java. Does abstraction relate to the principles of OOP?

I wanted to ask, does абстракция apply to the principles of OOP? Why on some resources only: наследование, инкапсуляция, полиморфизм?

Interfaces in OOP (Java), in a simple way?

Explain in a simple way, on your fingers, why and why you need interfaces (Java)? All these abstruse book definitions and formulations, do not add clarity at all.

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.

What are metaclasses in Python?

What are metaclasses in Python and what should I use them for? translation of the question What are metaclasses in Python? member @e-satis

task about php OOP

Task from one site, find the sum of the salaries of two objects. $name, $age, $salary are declared private. You need to creat ... t find the amount of salaries, the code outputs 100020000 at the end still adding 0, help find the correct amount of salaries

How to get a PHP class name

How do I get the name of the class that triggered the action in the parent class? Example: class ParentClass { function a ... $parentClass->action(); // ParentClass $childClass = new ChildClass(); $childClass->action(); // ChildClass

Differences between an abstract class and an interface (abstract class and interface)

What are the differences between an abstract class and an interface?

Association Vs Aggregation what is the difference?

The topic is hackneyed, but since I started learning UML for me, this has become one of the questions that I can not find a c ... moment when the container object is created be considered the fundamental difference between association and aggregation ???

Array of classes in C++

Good day, dear experts. I just got on the warpath with my ignorance of C++, so please be lenient if the question is stupid. ... erly organize an array of classes. If it is possible a tiny example would be..) Thank you in advance for your good advice )

Python. Creating a list class based on an array

Good afternoon. I have not been in oop in Python for quite a long time(if I may say so), and in connection with learning this ... rridden by [<classes.ChildClass_1.Car object at 0x03DA9E30>, <classes.ChildClass_1.Car object at 0x03DCE610>]