| |

VerySource

 Forgot password?
 Register
Search
View: 3928|Reply: 23

Please master teach how to new a class

[Copy link]

2

Threads

11

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2021-3-12 10:30:01
| Show all posts |Read mode
The constructor of a class is:
CActiveProcess::CActiveProcess(char *sname1,char *sname2,char *sname3,
               char *sname4,char *sname5,char *sname6,char*rname1,
               char *rname2,char *rname3,char* help,float *ture,
               float *errer,__int32 *finger);
I now want to create a new class, and I will prompt the error according to the following method
CActiveProcess* one = new CActiveProcess;
What is the correct way, thank you!
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2021-3-12 10:45:01
| Show all posts
CActiveProcess* one = new CActiveProcess(input parameter);
Reply

Use magic Report

2

Threads

11

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2021-3-12 11:00:02
| Show all posts
How to enter the parameters correctly Is this:
new CActiveProcess(char *sname1,char *sname2,char *sname3,
char *sname4,char *sname5,char *sname6,char *rname1,
char *rname2,char *rname3,char*help,float*ture, float*error,__int32 *finger);
But it also prompts no
Reply

Use magic Report

1

Threads

19

Posts

13.00

Credits

Newbie

Rank: 1

Credits
13.00

 China

Post time: 2021-3-12 11:45:01
| Show all posts
The input parameter is a constant, a variable name, not char *sname1
Reply

Use magic Report

2

Threads

11

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2021-3-12 12:15:01
| Show all posts
Can you give me specific methods for my class? Thank you!
Reply

Use magic Report

2

Threads

11

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2021-3-12 12:30:01
| Show all posts
I hope that big brother can give a concrete example for my class
Reply

Use magic Report

2

Threads

54

Posts

34.00

Credits

Newbie

Rank: 1

Credits
34.00

 China

Post time: 2021-3-12 12:45:02
| Show all posts
Can new class objects, not
new class
Reply

Use magic Report

0

Threads

49

Posts

34.00

Credits

Newbie

Rank: 1

Credits
34.00

 China

Post time: 2021-3-12 13:00:01
| Show all posts
Halo, I have never seen such a long parameter,
char *sname1 = ?;
char *sname2 = ?;
char *sname3 = ?;

new CActiveProcess(sname1,sname2,sname3,,,,,);//Other self-complement
Reply

Use magic Report

0

Threads

8

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2021-3-12 13:15:01
| Show all posts
CActiveProcess::CActiveProcess(char *sname1,char *sname2,char *sname3,
               char *sname4,char *sname5,char *sname6,char*rname1,
               char *rname2,char *rname3,char* help,float *ture,
               float *errer,__int32 *finger);
================================================
The parameters of this constructor are too complicated, and most of them are the same char*, which is not advisable in design, so replace all your code.
Reply

Use magic Report

0

Threads

9

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2021-3-12 13:30:01
| Show all posts
char param1[] = "test";
float param2 = 0.0;
int param3 = 0;

CActiveProcess *activeProcess =
new
CActiveProcess(
param1param1,param1,
param1param1,param1,param1,
param1,param1,param1,param2,
param2 ,param3 );
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list