Fortune Telling Collection - Horoscope - Which expert uses c++ to help me make a constellation class, such as constructor and overloaded function?
Which expert uses c++ to help me make a constellation class, such as constructor and overloaded function?
# contains "stdio.h"
# contains "string.h"
# contains "conio.h"
Classification and combination
{
Public:
Assemble ()
{//Default constructor
m _ Name = NULL
}
C assembly (char *name)
{//constructor overload
int len = strlen(name);
m _ Name = new char[len+ 1];
strcpy(m_Name,Name);
}
~ c assembly ()
{//destructor
if(m_Name! = empty)
{
Delete [] m _ name;
m _ Name = NULL
}
}
//public * * * function
char * GetName();
void set name(char * name);
void SetName(char* name,int len); //Function overload
void print name();
Private:
Char * m _ Name// private member function
int m _ Name _ Len
};
void c constellation::set name(char * name)
{
int len = strlen(name);
if(m_Name! = empty)
Delete [] m _ name;
m _ Name = new char[len+ 1];
strcpy(m_Name,Name);
}
Voidconstation:: set name (char * name, int len)// function overload.
{
if(m_Name! = empty)
Delete [] m _ name;
m _ Name = new char[len+ 1];
strcpy(m_Name,Name);
}
void CConstellation::PrintName()
{
Printf ("class name: cconstellation \ n \ n");
if(m_Name! = empty)
{
Printf ("The name of this object is: %s\n", m _ name);
}
other
{
Printf ("The name of this object is: null");
}
printf(" \ n * * * * END * * * * \ n \ n \ n ");
}
char * CConstellation::GetName()
{
Return m _ Name
}
void main()
{
Assembly temperature ("temperature");
Assembly temperature1;
Temperature 1. SetName(" Star ");
Temperature 1. print name();
At the time of ... printname ();
Set name at … ("change _ temp",12);
At the time of ... printname ();
Printf ("Press any key to exit! \ n ");
getch();
}
- Related articles
- What constellations are proud, noble and excellent wherever you go?
- Do you think the girl who marries that constellation is the happiest after marriage?
- What is the constellation of 1965 born on May 24th?
- Will you be pregnant during the Lantern Festival in 2022? When were you born?
When will you be pregnant during the Lantern Festival in 2022?
Lunar calendar:
2022 1 month 15
Gre
- How do constellation masters deal with Pisces girls?
- Who are the three constellations that will shine anytime and anywhere and make all psychological preparations?
- Seasonal Constellation _ Understanding Summer Constellations
- Draw 12 constellation avatar video
- Constellation International _ Constellation International Hotel
- Why Pisces and Gemini are fatal attractions?