Thursday, 15 September 2011

c++ - "virtual A* someMethod" vs "virtual class A* someMethod" -


I am trying to understand a piece of code that comes in this way:

  class A {// some class definition} class B {public: virtual A * someMethod (); Virtual Class A * Some Other Methods (); }  

I feel that the difference between someMethod and some other system (or if someone is present) is unable to understand - Both appear in virtual methods and are overlapped in both classes which are passed from B.

Can someone put some light on this virtual class syntax?

A class name , and class A is a wide type specifier if it is called A and nothing else, then the class named both A Look at

If anything else (a function or variable, perhaps) is called A , then an inefficient use of A will be referred to the class in that context To do this, you will need the detailed specifier class A as mentioned in the comments, you can also use without the previous declaration of class A class; To use the extended specifier, it is enough to present the name of the class in most names.

There is nothing to do with virtual function syntax; Both forms can be used to specify the type, regardless of the return type of the function or any other reference.


No comments:

Post a Comment