5,121 views
0 votes
0 votes

It is desired to design an object-oriented employee record system for a company. Each employee has a name, unique id, and salary. Employees belong to different categories and their salary is determined by their category. The functions get name, getId and compute salary are required. Given the class hierarchy below, possible locations for these functions are:

  1. getId is implemented in the superclass

  2. getId is implemented in the subclass

  3. getName is an abstract function in the superclass

  4. getName is implemented in superclass

  5. getName is implemented in subclass

  6. getSalary is an abstract function in the superclass

  7. getSalary is implemented in the superclass

  8. getSalary is implemented in the subclass

Choose the best design

  1. I, IV, VI, VIII
  2. I, IV, VII
  3. I, III, V, VI, VIII
  4. II, V, VIII

1 Answer

Best answer
2 votes
2 votes

Subclass, "derived class", heir class, or child class is a modular, derivative class that inherits one or more language entities from one or more other classes (called superclass,base classes, or parent classes). The semantics of class inheritance vary from language to language, but commonly the subclass automatically inherits the instance variables andmember functions of its superclasses. 

super class is also known as parent class  which is interited ( its property)  from child class or drived class.

so here 1. get id is implemented in the superclass

             4.get name is implement in the super class.

            6. getSalary is an abstract function in the superclass   bcoz  salary is determined by category.

           8.  get salay is implement in the sub class.

   its  true other than this is false.  option A is correct.

reference- https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)

selected by
Answer:

Related questions

0 votes
0 votes
0 answers
1
ayush201 asked Dec 7, 2018
1,041 views
Q.47. How many minimum relation tables are required which satisfy 1NF? A 2, 2, and 1 respectivelyB 2, 2, and 2 respectivelyC 1, 2, and 1 respectivelyD 1, 1, and 1 respect...
1 votes
1 votes
2 answers
2
learner_geek asked Jun 17, 2017
427 views
How to make many:one and one:many relation .give solution in form of below e-r diagram.