home work

X

xlzhang76

Hello, guys. this is a homework, could someone give some hint to me.
Assume you are about to design a class that reads a configuration file
from disk and provides some functions that can be called by other
classes to inquire the user settings that was provided in the
configuration file. The public parts of the class could look something
like this:
class ConfigurationFile
{
public:


ConfigurationFile(const char* filename);
~ConfigurationFile();
const char* GetValue(const char* name);


};

A number of fault conditions may arise when using this class. Describe
them and how you would design the fault handling for each one of them
in the class. Provide a convincing rationale for each choice.
 
G

Gernot Frisch

Hello, guys. this is a homework, could someone give some hint to me.
Assume you are about to design a class that reads a configuration
file
from disk and provides some functions that can be called by other
classes to inquire the user settings that was provided in the
configuration file. The public parts of the class could look
something
like this:
class ConfigurationFile
{
public:


ConfigurationFile(const char* filename);
~ConfigurationFile();
const char* GetValue(const char* name);


};

A number of fault conditions may arise when using this class.
Describe
them and how you would design the fault handling for each one of
them
in the class. Provide a convincing rationale for each choice.


If you want us to do your homework, be pretty sure that:
a) your tutor will obviously see that you didn't do it yourself
b) we will be happy to write code you won't understand within next 2
years.
So, do yourself a favour, do your homework. If you experience problems
come again with these.
-Gernot
 
R

Richard Herring

Hello, guys. this is a homework, could someone give some hint to me.
Assume you are about to design a class that reads a configuration file
from disk and provides some functions that can be called by other
classes to inquire the user settings that was provided in the
configuration file. The public parts of the class could look something
like this:
class ConfigurationFile
{
public:


ConfigurationFile(const char* filename);
~ConfigurationFile();
const char* GetValue(const char* name);

Ask your instructor why they are setting a bad example by not making
this a const function.
};

A number of fault conditions may arise when using this class. Describe
them

There are three functions above. Why not start by describing what you
expect each of them to do? Then you should have no trouble thinking of
some things that might go wrong with each of them. When you've done
that, you will be in a better position to address the second part:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top