Warning :: Derived class hides the base class virtual function

We are porting from CC5.3 to CC5.8 compiler with Sun Studio one compiler. After plenty of hurdles we are in the final stage of removing the warning messages... Amoung the plenty the following one is very common and in different files. Why am I getting this error in 5.8 and not in 5.3 compiler....
Warning: derived_Object::markRead Hides the virtual function base_Object::markRead(ut_SourceCodeLocation&) const in a virtual base
From this it is easily understandable that the base class mark read was hidden by derived class markRead... when we drive and override the derived class function.... It is all over the place....
Thank you,
Saravanan Kannan
//public: using xx_Object :: markRead;
virtual void markRead() const;

The Sun C++ FAQ discusses the warning message:
http://developers.sun.com/prodtech/cc/documentation/ss11/mr/READMEs/c++_faq.html#Coding1
Notice that warnings are not necessarily errors. But I applaud your desire to fix the code so that it generates no warnings. I wish more of our customers could be persuaded to do the same. :-)
C++ 5.3 issues this warning, by the way. Example:
struct B { virtual int foo(int); };
struct D : B { virtual int foo(double); }; // line 2
D d;
line 2: Warning: D::foo hides the virtual function B::foo(int).
If for your particular code you do not see a warning with C++ 5.3, it would be due to a bug in C++ 5.3 that was later fixed.

Similar Messages

  • How to call a method of a base class if the base class is abstract...

    This is my sample code>>>>
    abstract class b {
         public void display() {
              System.out.println("I am in Base Class");
    class test extends b {
         public static void main(String[] args) {
              test obj = new test();
              obj.display();
         public void display() {
              System.out.println("I am in Derived Class");
    I want to call base class version of display with derived class object.........is it possible....

    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    * headdesk *
    Enough with the friggin' zombie threads already!

  • Reflection: attributes from the base class

    Is there a way to get the attributes from the base class of a derived class via reflection? I only found methods to get the attributes from the derived class.
    Example:
    class A
    int a = 4;
    class B extends A
    int b = 5;
    Object unknown = new B();
    Code/Idea to get all attributes from baseclass A using unknown (here: a=4)?

    Thank you all for your hints. The mistake I make, was to use the baseclass, and not the derived class for getting the attributes. By using an extra parameter of type class I got all attributes in their context.
       private StringBuffer getDump(Object obj, Class cl)
             dmp.append(cl.getName() + " {\n");
             Field[] attribute = cl.getDeclaredFields();             <--- only the fields of the current class
             for (int j = 0; j < attribute.length; j++)
                attribute[j].setAccessible(true);
                try
                   if (attribute[j].getType().isPrimitive() || attribute[j].getType() == String.class)
                      dmp.append(attribute[j].getName() + "=" + attribute[j].get(obj) + "\n");
                   else
                      if (((attribute[j].getModifiers() & Modifier.STATIC) != Modifier.STATIC) &&
                          (attribute[j].getType().getName().startsWith("java.lang") == false) &&
                          ((attribute[j].getModifiers() & Modifier.FINAL) != Modifier.FINAL))
                         dmp.append(getDump(attribute[j].get(obj), attribute[j].get(obj).getClass())); <- recursive call
                catch (IllegalAccessException ex)
                   ex.printStackTrace();
             dmp.append("}");
          return dmp;
       }

  • Class override, how to create the child class and then the base class

    I started to write a program for a smart DMM, the problem is every version of the DMM the company change the communication commend.
    My idea is to write a child class for every DMM version and every SubVI of the child will override the base class SubVI.
    My problem is, i want first to create one child class and after i will see every thing is work,  start to create the base class. that way i will see if am thinking the right way.
    My question is
    How can i create a child class and then create the base class and configure the SubVi of the child class to be Override of the base class?
    I tried to search in the property of the class but i didn't see nothing.
    Thanks
    Solved!
    Go to Solution.

    This can be done and I've done it on occasion.
    You simply create the base class with the dynamic dispatch methods you require (connector panes need to be identical to thos of the child class).
    Then set the inheritance of the class to inherit from this base class.  If your method is defined as a dynamic dispatch method in the parent, you'll most likely now have some errors (unless your child method was already DD in which case you might just be OK already).
    To change the inheritance of a class, right-click the properties of the class in your project and select properties.  I believe the ineritance tree is at the lower end of the properties.  Click on the "change inheritance" (or something similar) to choose the class from which you now wish to inherit.
    Say hello to my little friend.
    RFC 2323 FHE-Compliant

  • Any way to hide the Option CLASS in the sales order line

    Any way to hide the Option CLASSes in the sales order line ? Not thru personalization .and also is there a way to explode the model automatically when we open the sales order form and line details ,rather than going to Tool--Show details everytime

    1) Don't know.
    2) Set "OM: Show Line Details" profile option to Yes.
    Hope this helps,
    Sandeep Gandhi

  • [svn:osmf:] 13027: Fix bug in SerialElement where the durationReached event was dispatched on a child-to-child transition due to the base class thinking that the duration had been reached  (since the second child didn't have a duration yet).

    Revision: 13027
    Revision: 13027
    Author:   [email protected]
    Date:     2009-12-16 18:09:46 -0800 (Wed, 16 Dec 2009)
    Log Message:
    Fix bug in SerialElement where the durationReached event was dispatched on a child-to-child transition due to the base class thinking that the duration had been reached (since the second child didn't have a duration yet).  Injection from trait refactoring.
    Modified Paths:
        osmf/trunk/framework/MediaFramework/org/osmf/composition/CompositeTimeTrait.as

    http://ww2.cs.fsu.edu/~rosentha/linux/2.6.26.5/docs/DocBook/libata/ch07.html#excatATAbusErr wrote:
    ATA bus error means that data corruption occurred during transmission over ATA bus (SATA or PATA). This type of errors can be indicated by
    ICRC or ABRT error as described in the section called “ATA/ATAPI device error (non-NCQ / non-CHECK CONDITION)”.
    Controller-specific error completion with error information indicating transmission error.
    On some controllers, command timeout. In this case, there may be a mechanism to determine that the timeout is due to transmission error.
    Unknown/random errors, timeouts and all sorts of weirdities.
    As described above, transmission errors can cause wide variety of symptoms ranging from device ICRC error to random device lockup, and, for many cases, there is no way to tell if an error condition is due to transmission error or not; therefore, it's necessary to employ some kind of heuristic when dealing with errors and timeouts. For example, encountering repetitive ABRT errors for known supported command is likely to indicate ATA bus error.
    Once it's determined that ATA bus errors have possibly occurred, lowering ATA bus transmission speed is one of actions which may alleviate the problem.
    I'd also add; make sure you have good backups when ATA errors are frequent

  • Introspector calling the Base Class multiple times

    Hi
    I am having a Java Bean C (which extends B which in turn extends A) ...and each of these Classes have the BeanInfo classes .. ABeanInfo , BBeanInfo , CBeanInfo....
    And i had written my beaninfos such a way that they are optimised by extending the basebeaninfo and calling super.getPropertyDescriptors and adding them to the Descriptoirs of extra methods like
    Class A
    private String name;
    public void getName()
    Class B extends A
    private String city ;
    public void getCity
    class ABeanInfo extends SimpleBeanInfo
    public PropertyDescriptors[] getPropertyDescriptors()
    // Got the property descriptor for name
    // return by forming array
    My Class B bean info will look like this
    class BBeanInfo extends ABeanInfo
    public PropertyDescriptors[] getPropertyDescriptors()
    PropertyDescriptors[] baseDesc = super.getPropertyDescriptors();
    // Get the property descriptor for City
    // Club the base class desc and the new ones added
    // return by forming array
    But when i use Introspector.getBeanInfo(B.class) , the A.getPropertyDescriptors method is getting called twice (One internally by the introspector and the other when my super.get...)
    How can this be avoided ?? Ofcourse after the first time , the introspector is caching the instances of BeanInfos...
    If this is the implicit behaviour , can i change my BeanInfo classses in such a way that it won't get called

    Why is this a problem?

  • ClassFileTransformer and how to transform the base class first

    Hello,
    I've written a ClassFileTransformer that uses ASM to enhance classes at load time.
    But some of the enhancements depends on possible enhancements to the super class.
    Example: under some coditions a method doWork() is inserted. This method did not exist in any class (doWork is just an example, I use a name that is not accepted by the compiler but allowed by the JLS).
      public class A {}
      public class B extends A {}If the method doWork() was inserted into class A, then the doWork() of B has to call doWork() of class A:
       super.doWork().Currently I try to load the base class by using
       loader.loadClass(superName.replace('/', '.'));this loads the super class but without passing my transformer !
    How can I solve this ?

    Looking at the comments in ClassFileTransformer.java and the code in ClassLoader, it seems the transformers are called only for class files that get a ClassFormatError. Transformers are intended to fix old broken/incompatible class files on the fly.
    I guess the intended way to do what you are doing is to define a custom class loader. Read class into byte[], transform, call defineClass() on the transformed byte[]. Google for java custom class loader for examples.

  • Can I create the object of an protected inner class of a Base class in to t

    Dear All,
    Can I create the object of an protected inner class of a Base class in to the subclass ?
    e.g.
    public class Base{
         protected class Inner {};
    Public class Sub extends Base{
         Public Inner amethod (){
              Return new Inner(); //here I get an exception as
                                //Inner has protected access
    }Regards,
    Ishan

    @Op. The code that you posted isn't close to compiling. Java is case sensitive. It should be public and not Public, and return instead of Return.
    Kaj

  • Why the constructor of the base class calls first when u run the java app.

    why the constructor of the base class calls first when u run the java application

    For the record the other very exciting questions are:
    pls give the differences between application server and web server with examples
    will u pls narrate the differences between servlet context and servlet config.....
    where can we find servlet config...
    is there any methods to access servlet config

  • [svn:osmf:] 11117: Fix inconsistency in NetStreamSwitchableTrait' s storage of currentIndex (now it's consistently on the base class).

    Revision: 11117
    Author:   [email protected]
    Date:     2009-10-23 16:33:31 -0700 (Fri, 23 Oct 2009)
    Log Message:
    Fix inconsistency in NetStreamSwitchableTrait's storage of currentIndex (now it's consistently on the base class).  Disable one specific unit test which is related to MockNetStream.  (Note that this unit test works when running against the network.)  Will fix later.
    Modified Paths:
        osmf/trunk/framework/MediaFramework/org/osmf/net/dynamicstreaming/NetStreamSwitchableTrai t.as
        osmf/trunk/framework/MediaFramework/org/osmf/traits/SwitchableTrait.as
        osmf/trunk/framework/MediaFrameworkFlexTest/org/osmf/MediaFrameworkTests.as
        osmf/trunk/framework/MediaFrameworkFlexTest/org/osmf/media/TestMediaPlayer.as

    Also, just to note, I am  only interested in VPAID Linear ad's working, Non-linears are for another day 

  • A non abstract child class must implement all pure virtual function of  parent abstract class in c++

    Hi,
    In Indesign SDK there is a class  IActionComponent having two pure virtual functions:
    virtual void
    UpdateActionStates(IActiveContext* ac, IActionStateList *listToUpdateGSysPoint mousePoint = kInvalidMousePoint, IPMUnknown* widget = nil) = 0;
    virtual void
    DoAction(IActiveContext* ac, ActionID actionID, GSysPoint mousePoint = kInvalidMousePoint, IPMUnknown* widget = nil)= 0;
    But, the child class
    class WIDGET_DECL CActionComponent : public IActionComponent
    implements only UpdateActionStates function and not DoAction function.
    There is no compilation error and the code is running fine..HOW
    Can some one please explain me?

    Oops!!! there is a small correction in my C++ program. The JunkMethod is being called from the constructor...like the following code.
    #include <iostream.h>
    #include <stdlib.h>
    class Base
        public:
            Base()
                cout<<"In Base Class constructor..."<<endl;
                JunkMethod();
            void JunkMethod()
                TestAbsFunc();
            virtual void TestAbsFunc()= 0;
    class TestAbstract:public Base
        public:
            TestAbstract()
                cout<<"In Extend Class constructor..."<<endl;
            void TestAbsFunc()
                cout<<"In TestAbsFunc...."<<endl;
    int main()
          TestAbstract test;
          return 0;
    }You can see the change in the constructor of the Base class. JunkMethod is being called, just to bluff the compiler to call the virtual method (so that it won't crib saying that abstract method cannot be called from the constructor). When Java is supporting this functionality without giving any errors, C++ gives errors when you call an abstract method from the constructor or fails to execute when I do some work around like this. Isn't it a drawback of abstract funcationality supported by C++ (I'm not sure if it's a drawback or not)
    Regards,
    Kalyan.

  • Difference between abstract class and the normal class

    Hi...........
    can anyone tell me use of abstract class instead of normal class
    The main doubt for me is...
    1.why we are defining the abstract method in a abstract class and then implementing that in to the normal class.instead of that we can straight way create and implement the method in normal class right...../

    Class vs. interface
    Some say you should define all classes in terms of interfaces, but I think recommendation seems a bit extreme. I use interfaces when I see that something in my design will change frequently.
    For example, the Strategy pattern lets you swap new algorithms and processes into your program without altering the objects that use them. A media player might know how to play CDs, MP3s, and wav files. Of course, you don't want to hardcode those playback algorithms into the player; that will make it difficult to add a new format like AVI. Furthermore, your code will be littered with useless case statements. And to add insult to injury, you will need to update those case statements each time you add a new algorithm. All in all, this is not a very object-oriented way to program.
    With the Strategy pattern, you can simply encapsulate the algorithm behind an object. If you do that, you can provide new media plug-ins at any time. Let's call the plug-in class MediaStrategy. That object would have one method: playStream(Stream s). So to add a new algorithm, we simply extend our algorithm class. Now, when the program encounters the new media type, it simply delegates the playing of the stream to our media strategy. Of course, you'll need some plumbing to properly instantiate the algorithm strategies you will need.
    This is an excellent place to use an interface. We've used the Strategy pattern, which clearly indicates a place in the design that will change. Thus, you should define the strategy as an interface. You should generally favor interfaces over inheritance when you want an object to have a certain type; in this case, MediaStrategy. Relying on inheritance for type identity is dangerous; it locks you into a particular inheritance hierarchy. Java doesn't allow multiple inheritance, so you can't extend something that gives you a useful implementation or more type identity.
    Interface vs. abstract class
    Choosing interfaces and abstract classes is not an either/or proposition. If you need to change your design, make it an interface. However, you may have abstract classes that provide some default behavior. Abstract classes are excellent candidates inside of application frameworks.
    Abstract classes let you define some behaviors; they force your subclasses to provide others. For example, if you have an application framework, an abstract class may provide default services such as event and message handling. Those services allow your application to plug in to your application framework. However, there is some application-specific functionality that only your application can perform. Such functionality might include startup and shutdown tasks, which are often application-dependent. So instead of trying to define that behavior itself, the abstract base class can declare abstract shutdown and startup methods. The base class knows that it needs those methods, but an abstract class lets your class admit that it doesn't know how to perform those actions; it only knows that it must initiate the actions. When it is time to start up, the abstract class can call the startup method. When the base class calls this method, Java calls the method defined by the child class.

  • Security Issue: How to create a derived role from the Base role

    Hi All,
    Kindly let me know how can i create a derived role from the base role?
    Please respond at the earliest.
    Thanks in advance.
    Ramesh.

    Go to PFCG and Create a role with desired Name.
    In the Description Tab, on the Left Side there is a text box for "Derive From "
    enter the Base role.
    Now your newly created role is derived from the Base role.
    Save the newly created role and again run PFCG, enter the Base role name and execute.Select Edit role. Go to Authorization tab.
    Edit Authorization.
    In the Menu Adjust Derived -> Generate and Adjust derive
    This will Generate the derived role.
    Now you may go and check the authorization in the derived role.

  • Can I use the inner class of one containing class by the other class

    Can I use the inner class of one containing class by the other class in the same package as the containing class
    eg I have a class BST which has inner class Enumerator. Can I use the inner class from the other class in the same pacckage as BST?

    Inner classes do not share the namespace of the package of the containing class. Also they are never visible to other classes in the same package.Believe what you want, then, if you're going to make up your own rules about how Java works. For people interested in how Java actually works, here is an example that shows why that assertion is false:
    package com.yawmark.jdc;
    public class Outer {
         public class Inner {
    }And...
    package com.yawmark.demo;
    import com.yawmark.jdc.*;
    public class Demo {
         public static void main(String[] args) {
              assert new Outer().new Inner() != null;
    }~

Maybe you are looking for