Question: I finished this project and now I'm trying to do it in a different wayy to understant operators better.This is my main : int main()
I finished this project and now I'm trying to do it in a different wayy to understant operators better.This is my main :
int main() { Uint a(10); cout << "Constructeur avec size_t OK "; Uint b; cout << "Constructeur vide OK "; b = 3; cout << "Affectation OK "; const Uint c = 13; cout << uint64_t(c) << " = 13: cast explicite vers uint64_t "; }
This is my class Uint,hpp
#includeusing namespace std; class Uint { private: char *str; public: // Constructors Uint(); // Default constructeur Uint(size_t n); // Constructeur avec size_t explicit operator uint64_t() const; //Cast explicite ~Uint();
};
This is my Class Uint.cpp
using namespace std; //No args constructor Uint::Uint() : str(nullptr){ str = new char[1]; *str='\0'; } Uint::Uint(uint64_t n){} //I need an answer Uint::operator uint64_t ()const{} //I need an answer Uint::~Uint() { if(str == nullptr) { } else{ } delete[]str; } Can someone tell me how to convert a int to char *str and return it ?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
