+ 8

Constructor

Why a constructor cant be virtual?

14th Nov 2018, 12:14 PM
Mehran Farokhmehr
Mehran Farokhmehr - avatar
9 Respostas
+ 3
if a class has a constructor it has to be able to build an Instance of that class. If it was virtually all the sub classes of that class would have to implement it but the class itself would fail to be able to produce an object. Therefore if a base class has a constructor, it cannot be virtual
21st Dec 2018, 5:49 AM
Rick Shiffman
Rick Shiffman - avatar
+ 7
1.'Virtual' can be used for methods called on objects, but constructor is used to create an object. 2.You cannot override base class constructor in derived class, so making constructor virtual is pointless. 3.Constructor cannot be virtual, but destructor can.
14th Nov 2018, 3:40 PM
Aleksander Szczepura
Aleksander Szczepura - avatar
+ 5
I think it's just spam
15th Nov 2018, 9:39 PM
Aleksander Szczepura
Aleksander Szczepura - avatar
14th Nov 2018, 7:34 PM
Mehran Farokhmehr
Mehran Farokhmehr - avatar
0
labas
15th Nov 2018, 6:54 PM
Emilija Radvilate
Emilija Radvilate - avatar
0
Emilija Radvilate what is that ? :/
15th Nov 2018, 8:19 PM
Mehran Farokhmehr
Mehran Farokhmehr - avatar
0
Здравствуте меня завот Алекс
18th Dec 2018, 9:12 AM
Alex
Alex - avatar
- 1
Здарова пиндосы, как жизнь?
18th Nov 2018, 8:50 AM
Денис
Денис - avatar
- 2
Zdarova pindosi kak zizn
18th Nov 2018, 8:50 AM
Денис
Денис - avatar