Abstract type problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Abstract type problem

  1. #1
    Join Date
    May 2009
    Posts
    3

    Abstract type problem

    Hi people,

    I am really struggling with this one!

    My class and implementation: (it should inherit from MyFramework::
    TcpReceiver)

    ------------------------- >MyConnection.h

    #ifndef MYCONNECTION_H_
    #define MYCONNECTION_H_

    #include "TcpReceiver.h"


    class MyConnection : public MyFramework::TcpReceiver {

    public:
    MyConnection(const std::string &cfg, const std::string &feed_name);
    ~MyConnection();

    };

    #endif

    --------------------->MyConnection.cpp

    #include <iostream>
    #include "MyConnection.h"

    using namespace std;
    using namespace MyNamespace;
    using namespace MyFramework;

    MyConnection::MyConnection(const std::string &config, const
    std::string &connection){

    cout<<("Calling constructor")<<endl;

    };

    MyConnection::~MyConnection(){};

    ------------------------> In my main, I do this:

    MyConnection recv(config, connection);


    ERROR: cannot declare variable recv to be of abstract type
    MyConnection.

    Now this is driving me nuts.HELP!

  2. #2
    Join Date
    Nov 2006
    Posts
    1,611

    Re: Abstract type problem

    What pure virtual functions in MyFramework::TcpReceiver are not in MyConnection?
    If my post was interesting or helpful, perhaps you would consider clicking the 'rate this post' to let me know (middle icon of the group in the upper right of the post).

  3. #3
    Join Date
    Apr 2007
    Location
    Mars NASA Station
    Posts
    1,436

    Re: Abstract type problem

    Yes, as pointed out JVene. There are some virtual function in base class that are not defined in derived class.

    Look into it.
    Thanks for your help.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center