I don't really understand what you said.
Well, for instance suppose you have a class defined like this:
Code:
class Applestack
{
private:
int size;
string color;
public:
Applestack(int s, string str)
{
size = s;
color = str;
}
Applestack()
{
size = 0;
color = "";
}
void display()
{
cout<<size<<endl;
cout<<color<<endl;
}
};
1) What are the two ways you can create objects of that class?
2) Besides the constructors, what methods does the class contain?
3) How would you call a method of the Applestack class using an Applestack object?
4) Suppose you have another class called DogKennel that is defined like this:
Code:
class DogKennel
{
private:
double capacity;
public:
DogKennel(double c)
{
capacity = c;
}
void show()
{
cout<<capacity<<endl;
}
};
Could you call the display() function in the Applestack class using a DogKennel object? Why or why not?
5) Does the Applestack class have an empty() method? Why or why not?
6) Can you find out the capacity of a DogKennel object by calling a size() method? Why or why not?