B
B
BoryanNikitin2020-07-21 07:55:29
Python
BoryanNikitin, 2020-07-21 07:55:29

How to use different external methods in a class method?

Hello! The task is this: to implement the RSA class, in which there will be different checks for simplicity, exponentiation, etc. to measure the final speed of execution. The idea came up like this: Implement the methods of the used operations and checks in the parent class, the child will have an implementation of RSA. However, then how to make different instances of the child class? That is, for example, there is an encryption method. It needs to be raised to a power. How to make the erection different (self-written and pythonic, for example)? Do not rewrite the same method again.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alekseyHunter, 2020-07-21
@BoryanNikitin

To do this, there is a redefinition of methods, when the heir overlaps the implementation of the parent.
This requires making the child class abstract and making 2 descendants from it with different definitions of the encryption algorithm.
If you don't want to do this, make 2 different encryption methods and name them according to the applied algorithm.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question