Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


class X
{
public:
int x;
static void f(int z);
};
void X::f(int y) {x=y;}
What is the error in the sample code above?
a) The class X does not have any protected members.
b) The static member function f() accesses the non-static z.
c) The static member function f() accesses the non-static x.
d) The member function f() must return a value.
e) The class X does not have any private members.

Answers were Sorted based on User's Feedback



class X { public: int x; static void f(int z); }; void X::f(int y) {x=y;} What i..

Answer / guest

option 'c' is the answer

Is This Answer Correct ?    12 Yes 2 No

class X { public: int x; static void f(int z); }; void X::f(int y) {x=y;} What i..

Answer / d289

The error is in x not being referenced/initialized properly.

Is This Answer Correct ?    1 Yes 4 No

Post New Answer

More C++ General Interview Questions

What is the difference between public, private, protected inheritance?

12 Answers   Wipro,


What are the types of container classes?

0 Answers  


Const char *p , char const *p What is the difference between the above two?

0 Answers   TCS,


Why pure virtual functions are used if they don't have implementation / When does a pure virtual function become useful?

1 Answers  


What is & in c++ function?

0 Answers  


Do we have private destructors?

12 Answers   Symphony, TCS,


Explain shallow copy?

0 Answers  


What is c++ programming language?

0 Answers  


Write syntax to define friend functions in C++.

0 Answers   HAL,


Can we define a constructor as virtual in c++?

0 Answers  


Which one is a preferred language C or C++? Why?

0 Answers  


What is linked list in c++?

0 Answers  


Categories