CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: zio_mangrovia

Page 1 of 5 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    6
    Views
    545

    Re: virtual function in derived class

    This is not project and It's not good programming but It's just exam exercise to understand overloading, virtual functions and classes.
    My target is to understand because It's invoked C::f, perhaps...
  2. Replies
    6
    Views
    545

    Re: virtual function in derived class

    f is a virtual function see void virtual f()=0;
    If I understand right, f is inherited from its all derived classes.
  3. Replies
    6
    Views
    545

    virtual function in derived class

    #include <iostream>
    using namespace std;

    class A {
    public:
    A() {cout << "nuovo A" << endl; };
    void virtual f()=0;
    void g() {cout << "g di A" << endl; }
    };
  4. Replies
    5
    Views
    475

    Re: call derived class function

    Thanks to your explanation, everything has finally become clear to me.
    It's scope problem, but executed code is inside class where method is called.


    These are Italian university exercises for...
  5. Replies
    5
    Views
    475

    Re: call derived class function

    Thanks for your answer.
    But B is derived class so I thought stampa() belongs to B class too, because both X and stampa() are inherited from A class.
    Where I'm making mistake ? I'd like to...
  6. Replies
    5
    Views
    475

    call derived class function

    #include <iostream>
    using namespace std;

    class A{
    protected:
    int x; int y;
    public:
    A(){ x=1, y=2; };
    void stampa () {cout << x << '\t' << y...
  7. Re: implicit conversion in derived classes

    Thanks.
    These ones are examples for learning derived class, not really used in C++ programming.
  8. Re: implicit conversion in derived classes

    Ok. thanks for your help but I'm trying to apply your explanations:


    #include <iostream>
    using namespace std;


    class R {
    protected:
    int z;
  9. Re: implicit conversion in derived classes

    No polymorphism.

    I'd like to understand what happens in these 2 cases:


    implicit conversion from pointer of derived class to pointer of base class e.g. pp = ps;
    implicit conversion from...
  10. implicit conversion in derived classes

    public:
    int a;
    string nome;
    string cognome;
    int eta;
    Persona() { cout << "class Persona" << a << endl; }
    void stampa() { cout << "method Persona " << a << endl << endl; }
    };

    class...
  11. Replies
    7
    Views
    663

    sort vector of struct

    I run this code for make exercises with STL but I got message "segmentation fault".
    If I reduce N value to 10, there is no problem.
    Suggestion please?




    #include <iostream>
    #include...
  12. Replies
    7
    Views
    692

    Re: binary search tree

    Good idea, I'll try again to write code according to your suggestion.
    Thanks
  13. Replies
    7
    Views
    692

    Re: binary search tree

    final.push_back(tree->D);

    This statement doesn't change algorithm complexity, right? It's O(1), right?
  14. Replies
    7
    Views
    692

    Re: binary search tree

    you can't imagine how much you helped me to understand problem.
    I thought to this procedure and it Works.... after 2 daysssss


    struct node { // D is max dist. from node to leaf of same type...
  15. Replies
    7
    Views
    692

    Re: binary search tree

    I don't find to think the way using recursion to keep track of node type to compare, for example, to every leaf (which are at several levels)
    I think It's easy if I have to calculate this Properties...
  16. Replies
    7
    Views
    692

    binary search tree

    I need help because I'm not able to write code for this exercise:

    I have binary search tree where every node has label of integer type.
    Node is said even (odd) type if its label is even (odd)....
  17. Replies
    7
    Views
    680

    Re: pass to function

    I noted It's possible to manage <vector> even in this way:




    void printcode(volo* pp, int nn) {
    for (int i=0; i<nn; ++i) {
    cout << pp[i].codice << endl;
    cout << pp[i].num << endl;...
  18. Replies
    7
    Views
    680

    Re: pass to function

    I don t understand what means here & symbol
  19. Replies
    7
    Views
    680

    pass to function

    I'm making tests about <vector> and I want to pass it to function to insert some values, e.g.


    #include <iostream>
    #include <vector>
    #include <cstring>
    using namespace std;

    struct volo {...
  20. Re: implementation of binary search tree by class

    In solution A, It's right to define "insert" function in private section of class? Could I define it into public section? What advantages could I get?
  21. Re: sort vector of struct: segmentation fault

    Thanks for your precious suggestions.



    Thanks.
  22. Re: implementation of binary search tree by class

    I tested both ones and work but I'd like to know if It exists reason to choose one of them, I don't say about efficiency but just for RIGHT implementation choice.
  23. Re: sort vector of struct: segmentation fault

    I wrong.





    I wrong again.

    You are right both points.
  24. implementation of binary search tree by class

    I want to create a binary search tree by class so I thought to this one:



    struct node {
    int info;
    node *left, *right;

    node(int info):
    left(NULL),
  25. sort vector of struct: segmentation fault

    I want to sort vector which is composed by struct elements, but I don't understand because sort function gives segmentation fault. Where I'm making mistakes?


    #include <iostream>
    #include...
Results 1 to 25 of 103
Page 1 of 5 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)