This is the question I was asked in an interview.

Paul Herring <[EMAIL PROTECTED]> wrote:
On 8/7/06, Gopi Krishna Komanduri <gopikomanduri@yahoo.com> wrote:

Hi All,
           I have a class with name x and also a function ( independent of class) with same name. In main function I tried to declare an object for my class ( I thought we cann't assaign variable for a function with out declaring a prototype with typedef for a needed syntax). But I am getting error. Could any one of you explain what is the priority for memory allocation .
#include "stdafx.h"

void x()
{
    cout<<"Hai";
};
class x
{
public:
    x()
    {
    }
};
int main(int argc, char* argv[])
{
    x t;

class x t;

    return 0;
}


Why have you got a global function with the same name as a global class in the first place??

--
PJH

Into motorcycles? Need parts? Try www.gissit.com to contact lots of motorcycle breakers - free to use (UK based at the moment)



GopiKrishna Komanduri
Software engineer
NCR Corporation PVT Ltd.
Policelanes
Begumpet
Hyderabad
9849124680
[EMAIL PROTECTED]
[EMAIL PROTECTED]

 


Groups are talking. We´re listening. Check out the handy changes to Yahoo! Groups. __._,_.___

To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.




SPONSORED LINKS
C programming language Programming languages Computer programming languages
Java programming language


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to