C++ Help ...

Ben Duncan bend at linux4ms.net
Fri Aug 14 07:15:09 PDT 2009


Ok, I have been looking at some C++ code lately and even though I am
proficient in C, I cant seem to figure certain things ount in C++. maybe some
can explain them to me....

In the following snippet of code:
--------------------------------------------------------------------------------------
> FileMgr::FileMgr(const char *fname, int rsize, int ctype, int mode, int file_des) :
> 	DiskMgr(ctype)
> 	{
> 	aaao = new char[strlen(fname) + 1];
> 	strcpy(aaao, fname);
> 	aaar = rsize;
> 	aaaq = aaar + 2;
> 	fd = -1;
>     aaas = 1;
> 	if (mode == moOpen)
> 		{
> 		open_file();
> 		}
> 	if (mode == moAlreadyOpen)
> 		{
> 		fd = file_des;
>         aaas = 0;
> 		int tmp_aaaq = -1;
>         DiskMgr::read(fd, &tmp_aaaq, 0, sizeof(tmp_aaaq));
> 		if (tmp_aaaq != aaaq)
> 			{
> 			IsamError("Error: Program and Data Files out of sync!");
> 			exit(0);
> 			}
> 		}
> 	aaau = -1;
> 	aaav = 6;
> 	}
> 
> FileMgr::~FileMgr(void)
> 	{
>     close_file();
> 	delete aaao;
> 	}
------------------------------------------------------------------------------------------

What does the "FileMgr::FileMgr(c..." mean to a C programmer like me?

Embedded in the that code is  "DiskMgr::read(fd, ...."  whatd does that
mean and do?

And finally, there is this at the bottom: "FileMgr::~FileMgr(void)"
What does that do?

Thanks ...


-- 
Ben Duncan - Business Network Solutions, Inc. 336 Elton Road  Jackson MS, 39212
"Never attribute to malice, that which can be adequately explained by stupidity"
        - Hanlon's Razor



More information about the Linux-users mailing list