Can I declare members in abstract class? Should I declare a virtual getter / setter method for the member in that class? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Can I declare members in abstract class? Should I declare a virtual getter / setter method for the member in that class?

23rd Nov 2016, 1:46 PM
Marcell Juhasz
2 ответов
0
yes, you can, but creation of abstract objects is prohibited (it's possible with some hack, but useless I think)
25th Nov 2016, 12:52 AM
Bohdan Shevchenko
Bohdan Shevchenko - avatar
0
for real it's easy hack, U just allocate memory which needed for fields of abstract class and then link this memory by pointer of this class x) (when you will allocate memory don't forget about possible alignment of memory)
25th Nov 2016, 12:57 AM
Bohdan Shevchenko
Bohdan Shevchenko - avatar