mercredi 7 juillet 2021

customize initialize class in c++

i have a class names NumBase, and i wanna initialize these object of class with a special customization, Like that >>

is there any way to initialize exact like this way ?

NumBase<8> Num1 = 2312347;
NumBase<10> Num2 = 23123479;
NumBase<16> Num3 = 23F13A47;

or

NumBase(8) Num1 = 2312347;
NumBase(10) Num2 = 23123479;
NumBase(16) Num3 = 23F13A47;

NEW EDIT:

NumBase(12) Num1 = 2312A47;

also

NumBase<8> Num1(2312347);
NumBase<10> Num2(23123479);
NumBase<16> Num3(23F13A47);

*** not this: ( specially in this case )

i don't wanna use string.

NumBase<16> Num3("23F13A47");

or

NumBase<16> Num3 = "23F13A47" ;

thanks for answering..

Aucun commentaire:

Enregistrer un commentaire