• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inheritance or Class and its instance

 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. What is the relationship between a “flower” and a “Rose”?
a. Inheritance
b. Association
c. Class and its instance
d. Interface and its implementation
e. Composition

2. What is the relationship between “Company” and “XXXX”?
this xxx is a company name.

a. Inheritance
b. Association
c. Class and its instance
d. Interface and its implementation
e. Composition
the answer to the first question is a,but second one is c.
i got this two questions from internet.
but i think second question answer must be a
is this correct?
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Is Company Name can be defined as class ? think about it ? Where as Rose can defined as Class with supertype as Flower.
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no you don't understand my question.xxx is a real company name.i mean xxx may be Google or...
 
stanislav bashkirtsev
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's just a name of the company, it's a field in the Company class. But I don't know why it is an instance %) silly question
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

So do you create a Class called Google or would create a instance for Company and assign company name as "Google". Thats stupid to create a Class called Google.. Say you have another company called Sun , will you create a new Class Sun or instantiate Class Company and asssign company nae as "Sun" how many you create then for each requirement ?
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hay give the answers for this


what are the answers for these two questions?

if i answer this i give both questions a
but i saw in the internet first question a and second one is c?
 
stanislav bashkirtsev
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, now I understand. Company - is a class and Google - is a concrete object of the class. Internet is right
 
sam liya
Ranch Hand
Posts: 1243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
then why can't we think as floer and rose as like this?
 
stanislav bashkirtsev
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because Flower - is an abstraction and Rose is a concrete realization. But! You can also create such Flower class that would be working likewise Company. Just don't think about these questions like about something serious. You can solve a lot of problems in different ways and each of these ways will be correct. So just take it easy. You were right as well
 
sudheer kiran
Ranch Hand
Posts: 237
Firefox Browser MyEclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there are different anwsers
a flower is an abstract class and a rose is concrete class which inherits flower.
so there exists inheritance

company is a class and google is an instace of the class type company.
then there exists instance relation.
if wou wanna make google a concrete class then you have to create a concrete class for each named company.


 
amod gole
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Arun,

What I think “flower” and a “Rose” can have
a.] Inheritance :- Rose can be class because we can have rose of different type
c.] Class and its instance now its depend on requirement
relationship



relationship between “Company” and “XXXX”
v] Class and its instance
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic