Day 4 - copy/paste n' decorating
char then int then float then double.
When I think about it there are situatins where it has to be char,
and there are situations where there has to be int and not char.
In some situations float is necessary because it's optimal.
Fortunately there is copy/paste.
The best thing is to divide them into separate files.
On the old name MyClass I want to add the type of a.
It will look ugly but, ...
Erase file MyClass.hpp and change it with four new ones.
file: MyClass_char.hpp
#ifndef _HPP_MyClass_char
#define _HPP_MyClass_char
class MyClass
{
public:
MyClass( char P_a ): M_a( P_a ){ }
void clac(){std::cout << "Do not disturb! calc in progress ..." << std::endl; }
private:
char a;
}
#endif
file: MyClass_int.hpp
#ifndef _HPP_MyClass_int
#define _HPP_MyClass_int
class MyClass
{
public:
MyClass( int P_a ): M_a( P_a ){}
void clac(){std::cout<< "Do not disturb! calc in progress ..."<< std::endl; }
private:
int a;
}
#endif
file: MyClass_float.hpp
#ifndef _HPP_MyClass_float
#define _HPP_MyClass_float
class MyClass
{
public:
MyClass( float P_a ): M_a(P_a){}
void clac(){ std::cout<< "Do not disturb! calc in progress ..."<< std::endl; }
private:
float a;
}
#endif
file: MyClass_double.hpp
#ifndef _HPP_MyClass_double
#define _HPP_MyClass_double
class MyClass
{
public:
MyClass( double P_a ): M_a( P_a ){}
void clac(){ std::cout << "Do not disturb! calc in progress ..."<< std::endl; }
private:
float a;
}
#endif
Hard day today.
I am dead tired.
If somethig new occures I'll use copy/paste.