• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is there any Virtual Constructor in Java?  RSS feed

 
ramakrishna rayudu
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi..

is there any term call Virtual Constructor in Java??
if it there can you tell me where we need to use this??

Thanks,
Ramakrishna Rayudu.
 
Mohamed Sanaulla
Bartender
Posts: 3185
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know, No, there isn't any such term
 
Claudiu Chelemen
Ranch Hand
Posts: 75
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's been a similar post opened on CodeRanch some time ago, here's the link:
http://www.coderanch.com/t/191707/java-programmer-SCJP/certification/Virtual-Constructor

Otherwise, I found out that the term "virtual constructor" in Java may refer to the creation of objects using Factory/Abstract Factory design patterns.

Cheers!
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've never heard of the term "virtual constructor", so no, it is not a common term that is used in Java.
 
Ralph Cook
Ranch Hand
Posts: 479
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the Wikibooks page (http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Virtual_Constructor), it has:

Intent

To create a copy of an object or a new object without knowing its concrete type.

Also Known As

Factory Method of initialization

And no, there no equivalent java language construct. You'll find plenty of factory methods in java applications, however...

rc
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!