Re: C++ in embedded systems

From: Jimen Ching (jching_at_flex.com)
Date: 08/30/03

  • Next message: David Turvene: "Re: Xscale PXA255 versus PXA250"
    Date: Sat, 30 Aug 2003 07:46:19 -0000
    
    

    In comp.arch.embedded George Neuner <gneuner2@comcast.net> wrote:
    >class A;
    >class B : public A;
    >void F( A &a );
    >void F( B &b);
    >void G( B &b );
    > :
    >A *pA = new B;
    >F( *pA ); // calls F(A) not F(B)
    >G( *pA ); // error ... argument is not a reference to B
    > :

    This is one of those misconceptions I was talking about. This is not
    OOP at all. This is just function overloading. Which has nothing to
    do with OOP. What you really want to do is use polymorphism.

    --jc

    -- 
    Jimen Ching (WH6BRR)      jching@flex.com     wh6brr@uhm.ampr.org
    

  • Next message: David Turvene: "Re: Xscale PXA255 versus PXA250"

    Relevant Pages

    • Re: C++ in embedded systems
      ... >This is one of those misconceptions I was talking about. ... >do with OOP. ... What you really want to do is use polymorphism. ... objects in C++ don't behave as objects, ...
      (comp.os.linux.embedded)
    • Re: Poly Couples
      ... a *clean* hierarchical taxonomy. ... It is a fairly common OOP training example. ... Please learn what polymorphism mean in CS. ... and even in OO it doesn't have to be tied to class hierarchies. ...
      (comp.object)
    • Re: Inheritance and Polymorhpism (getting back to the point)
      ... > claiming that VB macro-coding Real Programmer wannabees could ... do not confuse polymorphism with OOP. ... more and more encapsulation, polymorphism, and inheritance. ...
      (comp.object)
    • Re: Paradigms which way to go?
      ... Sorry but as you may have worked out, we did not learn a huge amount on Enterprise development, I can write code that will square numbers, simulate queues & stacks, we even learnt about basic data types using Assembly Language, ALU, CPU's etc but nothing it seems that is going to sit too well at an interview for a job in programming, but it seems the course did not cover this, we did little to do with web based programming apart from HTML some and nothing about web based services, or anything really that went beyond connecting an app to ... _That_ is polymorphism, the heart of OO. ... declaring a variable/pointer to it's base type, and then calling a function called draw, and as long as the derived type supports a method called draw it will know how to draw whatever was assigned in it's code, otherwise the call will be ignored or the base class draw method will be called or something like that? ... An OOP catches more problems at compile time, by aligning the polymorphism with the concept of interfaces and encapsulation. ...
      (comp.programming)
    • Re: OO Design induces an existential crisis
      ... >> Mind you in all other parts of this project I just used plain old OOP, ... > database instead of hard-wired into code as class hierarchies and class ... >> Subroutines alone don't solve the problem. ... databases and polymorphism and ... ...
      (comp.object)