• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Inheritance or Class and its instance

 
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 237
MyEclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic