GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  Concepts  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 39 of 64    Print  
How do you differentiate between a constructor and normal function?

  
Total Answers and Comments: 2 Last Update: May 02, 2007     Asked by: ykbharat 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: christia
 
A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator. An ordinary member function has its own name, a return type (which may be void), and is invoked using the dot operator.

Above answer was rated as good by the following members:
achintya
March 26, 2007 03:21:45   #1  
       

RE: How do you differentiate between a constructor and...
functions have return type but constructors dont have return type.
 
Is this answer useful? Yes | No
May 02, 2007 18:23:45   #2  
christia Member Since: July 2006   Contribution: 116    

RE: How do you differentiate between a constructor and...
A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator. An ordinary member function has its own name, a return type (which may be void), and is invoked using the dot operator.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    

 Related Questions

Please suggest use of FO  
Latest Answer : Function overloading is done for code reuseability, to save efforts, and also to save memory. ...
Read Answers (13) | Asked by : harsha

While copying the objects if you say X a = b and asssume that '=' operator is overloaded then what it will call, a copy constructor or operator overloading function
Read Answers (7) | Asked by : Amit Joshi

Latest Answer : We can pass arguments into the macro as well as function.We can say that a Macro is smilar to a global function ...
Read Answers (8) | Asked by : skr_ymca

Latest Answer : Actually macro is faster than a function as the previous one does not go for scanning and validation like a real function, so the time is saved during these processes which makes macro faster. ...
Read Answers (4) | Asked by : supriya

Latest Answer : Actually size of class having no variable but only 1 function is determined by the variables size declared in that fuction. So the size of the class will be the total size of variables which have been declared in that member function. ...
Read Answers (4) | Asked by : anamika

Latest Answer : A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is invoked using the new operator. An ordinary member function has its own name, a return type ...
Read Answers (2) | Asked by : ykbharat

Latest Answer : There are three differences. 1. In Java constructor has its class name. that can be unique. In .NET it has "NEW" by name. 2.It does not have any return type. 3. It cannot be subclass. ...
Read Answers (1) | Asked by : ykbharat

Latest Answer : Implicit cursor we have to open and close for  it's usage.It will not automatically close.Explicit cursor will automaticlly open and close.eg: for x in (exp.)       where x is the cursor name exp. is an expression.This ...

View Question | Asked by : pratibha

Latest Answer : Global constructors and destructors in C++ have to be handled very carefully to meet the language specification. Constructors have to be called before the main function. Destructors have to be executed after it returns.The answer of this question is ...


 Sponsored Links

 
Related Articles

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

OOPS Tutorials

Object oriented programming OOP is a computer science term used to characterize a programming language that began development in the 1960’ s The term object oriented programming’ was originally coined by Xerox PARC to designate a computer application that describes the methodol
 

C++ Pure Virtual Function and Base Class

C Pure Virtual Function and Virtual Base Class In this C tutorial you will learn about pure virtual function declaration of pure virtual function and virtual base class virtual base class and how to implement a virtual base class explained with examples mosgoogle center What is Pure Virtual Function
 

SOA Concepts

SOA Concepts Today the concept of Service Oriented Architecture has become ubiquitous Evidence from recent years establish that SOA is not just about hype but a part of every major Business environment The truth is Service Oriented Architecture can be beneficial to Business only when it is utilized
 

C++ Function Passing Types

C Function Passing Types In this C tutorial you will learn about function passing types two types of arguments passing in functions passed by value  and  passed by reference are discussed here mosgoogle center The arguments passed to a function can be performed in two ways Passed
 

What is DECODE function used for?

DECODE is used to decode a CHAR or VARCHAR2 or NUMBER into any of several different character strings or numbers based on value. That is DECODE does a value-by-value substitution. For every value that is given in the DECODE function it makes an if then check and matches the value. The general format
 

printf() Function Return Value

What is the return value from printf() function? printf function always returns the number of characters printed. Let us understand this with an example: main() { int a=10; printf("%d",printf("%d %d %d", a,a,a)); } In this above program the inner printf i
 

How is the main() function declared?

The declaration of main can be done as int main() One more declaration that can be taken by main is command line arguments form int main(int argc, char *argv[]) or this can also be written as int main(argc, argv) int argc; char *argv[]; NOTE: It is not possible for one to declare the main
 

How does the function call within function get evaluated?

Whenever we have more than one function which is called for a finite number of times then such a function gets evaluated from inside out. Let us understand this concept with an example. For instance consider a function sample called within it 4 times as given in program below: main() { int a=50;
 

What happens when a variable is not initialized in main function?

When a variable is not initialized in main function it contains garbage value. This can be well seen from the example below main() { int x; printf(“%d”,x); z= sample() } sample() { printf(“Testing program”); } Output is   &n
 





About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape