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  >  Programming  >  C++
Go To First  |  Previous Question  |  Next Question 
 C++  |  Question 178 of 185    Print  
Legal Function Naming
Which of the following function name is legal in C++?
A. $_foo()
B. !_foo()
C. 1_foo()
D. -_foo()
E. #_foo()



  
Total Answers and Comments: 1 Last Update: September 10, 2008     Asked by: prettyfox 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
September 10, 2008 09:13:21   #1  
OSaienni Member Since: September 2008   Contribution: 8    

RE: Legal Function Naming

A is the only one that will work.

The reason are :

!, - are operators,

# is the preprocessor operator.
     #define, #pragma, also use #9 -> stringify value to char.


1 - numeric value (can be used at end of function / method)

$ isn't used in C++ (I may be wrong here but I've never used $) - So legal naming as its not a number/operator


 
Is this answer useful? Yes | No

 Related Questions

As the name suggests, the function acts as a friend to a class. As a friend of a class, it can access its private and protected members. A friend function is not a member of the class. But it must be 
Latest Answer : Its the main feature of a class that  private member data of a class can be accessed only by the class' member functions. But there is an exception , A class can allow non-member functions and other classes to access its own private data, by ...

 A virtual function allows derived classes to replace the implementation provided by the base class. The compiler makes sure the replacement is always called whenever the object in question is actually 
Latest Answer :    A virtual function allows derived classes to replace the implementation provided by the base class. ...

"Poly" means "many" and "morph" means "form". Polymorphism is the ability of an object (or reference) to assume (be replaced by) or become many different forms 
Latest Answer : C++ enables polymorphism - The ability of obejcts of different classes related by inheritance respond differntly to the same function call. ...

  Function overloading: C++ enables several functions of the same name to be defined, as long as these functions have different sets of parameters (at least as far as their types are concerned). This 
Latest Answer : The C++ compiler identifies a function by its signature (function signature). The function signature is broken down into the following components in that order.The parameter list ...

 The idea behind inline functions is to insert the code of a called function at the point where the function is called. If done carefully, this can improve the application's performance in exchange 
Latest Answer : inline function is a function which extends the code when it is invoked. Otherwise is skip the code. ...

Templates allow to create generic functions that admit any data type as parameters and return value without having to overload the function with all the possible data types. Until certain point they fulfill 
Latest Answer : template is used for creating generic functions as well as data members. ...

Namespaces allow us to group a set of global classes, objects and/or functions under a name. To say it somehow, they serve to split the global scope in sub-scopes known as namespaces.  The form to 
Latest Answer : Minimize name collision in the global name space, this  namespace keyword assining a distinict name to a libray to use the same indentifier names without creating any name collision further name more the  compiler uses the namespce signature for ...

A pure virtual member function is a member function that the base class forces derived classes to provide. Normally these member functions have no implementation. Pure virtual functions are equated to 
Latest Answer : Pure virtual function is a virtual function which has no defination in base class but must be redefined in derieved class or else compile time error will be generated by the compiler.any class which is having atleast on pure virtual function is termed ...

Virtual destructors: If an object (with a non-virtual destructor) is destroyed explicitly by applying the delete operator to a base-class pointer to the object, the base-class destructor function (matching 
Latest Answer : Virtual constructor is not build-in C++ feature but it doesn't mean its not used by devs in code and in conversations. There are many other things that doesn't exist in particular language yet, people find ways around to solve it (SingleTon, Virtual Constructor, ...

We can overload assignment operator as a normal function.But we can not overload assignment operator as friend function why?


 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
 

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
 

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 Data Naming Convention

Data Naming Convention refers to a convention established to resolve problems with Traditional data names. Many of these conventions are in use today, such as the Of Language, entity—attribute—class role—type—class prime—descriptor&m
 

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
 

What is the default return value of a function?

The default return value from a function is int. In other words, unless explicitly specified the default return value by compiler would be integer value from function.   When a programmer wants other than integer values to be returned from function then it is essential that the pro
 





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