F
F
faleaksey2019-03-20 14:31:08
JavaScript
faleaksey, 2019-03-20 14:31:08

How to implement inheritance?

Good day! There is a task to implement form validation in stages (first the key, then email, then sending the entire form)

class Form {
// метод отправки формы + проверка значенией из ValidField и ValidUser 
}

class ValidField {
// проверка валидности email,password
}

class ValidKey {
    // проверка ключа
}

The bottom line is that first we check and send the key (then we get a response from the server), if positive we give OK to enter (and check) email, and then we send the entire form!
In this case, class Form is parent and it is not entirely clear who should inherit what.
Or is it enough to implement 1 class (let's say Form) and already in it to "cram" the methods of checking and sending?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question