prg.cpp #define _CRT_SECURE_NO_WARNINGS #include #include using namespace std; class Name{ char* m_value=nullptr; public: void setName(const char* value) { m_value = new char[strlen(value) + 1]; strcpy(m_value,value); } void display(){ if(m_value) { void display(){ if(m_value) { }; } else { cout << m_value; } void deallocate(){ } cout<<"No Name"; delete[] m_value; int main(){ Name n; } n.setName("Ali"); n.display(); return 0;

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter6: Arrays
Section: Chapter Questions
Problem 15RQ
icon
Related questions
Question

post the output in porgram

prg.cpp
#define _CRT_SECURE_NO_WARNINGS
#include<cstring>
#include<iostream>
using namespace std;
class Name{
char* m_value=nullptr;
public:
void setName(const char* value)
{
m_value = new char[strlen(value) + 1];
strcpy(m_value,value);
}
void display(){
if(m_value)
{
}
void display(){
if(m_value)
};
{
}
{
}
else
cout << m_value;
}
}
void deallocate(){
cout<<"No Name";
delete[] m_value;
int main(){
Name n;
}
n.setName("Ali");
n.display();
return 0;
Transcribed Image Text:prg.cpp #define _CRT_SECURE_NO_WARNINGS #include<cstring> #include<iostream> using namespace std; class Name{ char* m_value=nullptr; public: void setName(const char* value) { m_value = new char[strlen(value) + 1]; strcpy(m_value,value); } void display(){ if(m_value) { } void display(){ if(m_value) }; { } { } else cout << m_value; } } void deallocate(){ cout<<"No Name"; delete[] m_value; int main(){ Name n; } n.setName("Ali"); n.display(); return 0;
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Dictionary
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage