I am trying to answer some practice questions, but I really don't know what to to with the following questions.

Given the following class definitions, identify the type of class relation
ship and determine both the superclass and sublcass.

  class Shape {} ;
  class Triangle: public Shape {} ;

end quote.

I guess shape would be the superclass and the other ones the subclasses?

We can successfully compile the following code and that is about it. What kind of class is it? Why is it creating an object of this class is not allowed.

  class Math {
    public:
       virtual double sqrt(double x) = 0 ;
       virtual double sine(double x) = 0 ;
       virtual double cosine(double x) = 0 ;
  } ;

end quote.

Could that be virtual inheritance?

Correct the problem that arises from the class relationship between the two classes.

  class Shape {
     int xOrigin ;
     int yOrigin ;

     pulblic:
        Shape(int x, int y) { 
           xOrigin = x ;
           yOrigin = y ;
        }
  } ;


  // ------------------------------------
  class Rect: public Shape {
     int x1, y1, x2, y2 ;
     public:
        Rect() {}       
  } ;

end quote.

No idea about this one... honestly. I hope somebody can help me.
Thanks a lot, it's appreciated!

Second problem: look up in your textbook about Pure Virtual classes and functions.

Third problem:
1. pulblic: -- mispelled
2. Shape needs a default constructor (one with no parameters)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.