nonstatic member reference Programming Software Development by poloblue … a class. The error that I'm getting is: a nonstatic member reference must be relative to a specific object in… Nonstatic references Programming Software Development by iamthesgt …->HangUp();`), and I get the error "IntelliSense: a nonstatic member reference must be relative to a specific object"… Re: Nonstatic references Programming Software Development by theguitarist …. Like [here](http://www.codeproject.com/Questions/458708/Error-a-nonstatic-member-reference-must-be-relativ). And when you say "… invalid use of nonstatic member Programming Software Development by nielsp …;< std::endl; } }; }; [/CODE] I get [ICODE]invalid use of nonstatic data member ‘X::m’[/ICODE] Thanks for help! Niels An object reference is required for the nonstatic field! Programming Software Development by Andy90 … understand it! "An object reference is required for the nonstatic field, method, or property 'member'" Please check my code… error:a nonstatic member reference must be relative to a specific object. Programming Software Development by venky019 …;>sname; string x; Sports x = Sports.getName();//error:a nonstatic member reference must be relative to a specific object. loc… Re: nonstatic member reference Programming Software Development by deceptikon You try to print `size` from a static member function, but `size` isn't a static member. To access non-static members, you need an object, because that's where memory for non-static members is allocated. Re: nonstatic member reference Programming Software Development by poloblue Deceptikon, would this work B.size; cout<<"size is"<<B.size>>endl; Re: nonstatic member reference Programming Software Development by deceptikon No, B is a class, not an object. Re: nonstatic member reference Programming Software Development by poloblue how about B tiger; Can you walk me through. Thanks Re: nonstatic member reference Programming Software Development by deceptikon I can't walk you through it because what you're doing isn't meaningful. `size` is an instance member, which means you must have created an object somewhere and given `size` a value that warrants outputting it. I don't think you should be printing `size` from printStatic() at all, so my suggestion would be to remove that line entirely. It's already… Re: nonstatic member reference Programming Software Development by poloblue thank you Re: Nonstatic references Programming Software Development by NathanOliver can you post the code that works and the code that doesnt? Re: Nonstatic references Programming Software Development by theguitarist That error is shown when you don't create an instance of a class and right away invoke a non-static member function of it. Are you doing that somewhere? Re: Nonstatic references Programming Software Development by iamthesgt > That error is shown when you don't create an instance of a class and right away invoke a non-static member function of it. > Are you doing that somewhere? The problem with the manager occurs in a public member function of class Client. Do I need to create an instance of the class Client inside the member function? I've never seen that. &… Re: Nonstatic references Programming Software Development by NathanOliver Post the block of code where the manger is used in your main function and post the code where your manger is used in another function and it doesnt work. Re: Nonstatic references Programming Software Development by iamthesgt I get no errors here (again, in function `int APIENTRY InnoVisitClient::_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)`): //set initial values through the manager manager = remoteClient->InitEngine(sipAccount, hWndChildVideo, hWndChildPreview); manager->SetStunServer(strStun); … Re: Nonstatic references Programming Software Development by NathanOliver Is mannager a member of `Client` or `InnoVisitClient`? Re: Nonstatic references Programming Software Development by iamthesgt manager is of type IRManager\*, which is defined in a seperate file. The manager object is a private member variable or class Client (sorry, where it said "InnoVisitClient" above should have been simply "Client") Re: Nonstatic references Programming Software Development by NathanOliver What does the IRManager class look like? What is the code for the `HangUp()` function? Re: Nonstatic references Programming Software Development by iamthesgt IRManager is a SIP Manager class. HangUp() just ends a call/connection. void IRManager::HangUp() { if(currentCallConnection) ClearCall(currentCallConnection->GetCall().GetToken()); } I don't think it's a problem with the function. It's declared properly, but the problem seems to be for *any member of IRManager that … Re: object reference required for nonstatic field. Programming Software Development by MJV I was stated in the title "object reference required for nonstatic field. Re: invalid use of nonstatic member Programming Software Development by StuXYZ You problem is scope. Let me walk through it even if you are familiar with it. (a) If you want to use m in class X. All is ok. (b) If you want to use m in class Y. Again all is ok, assuming Y does not define a local varaiant. (c) If you wan to use m in Z. NOT OK. You would not have been confuse if you has done this: [code=c++] class X { … Re: invalid use of nonstatic member Programming Software Development by nielsp Thanks! Niels. Re: An object reference is required for the nonstatic field! Programming Software Development by thines01 At what line does it give you the error? Re: An object reference is required for the nonstatic field! Programming Software Development by Andy90 line no. 24 I get red line under form1 Re: An object reference is required for the nonstatic field! Programming Software Development by vadriaan for line 24, try: [CODE]this.Location = new Point(deskWidth, 0);[/CODE] Re: An object reference is required for the nonstatic field! Programming Software Development by Andy90 @vadriaan Thankyou! Re: error:a nonstatic member reference must be relative to a specific object. Programming Software Development by deceptikon The compiler is right. Sports is a class name, and you can't use it to call a non-static method. To call getName() you first need to create an object of the Sports class. Re: error:a nonstatic member reference must be relative to a specific object. Programming Software Development by Ancient Dragon Just what do you expect getName() to return in that line? The statement [icode]Sport::getName()[/icode] means that getName() is a static method of the class and [b]name[/b] would also have to be a static member of the class. Probably what you want is [icode]this->getName();[/icode]