Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: inheritance
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 45881 of 47034
Post > Topic >>

Re: inheritance

by red floyd <no.spam@[EMAIL PROTECTED] > May 12, 2008 at 08:46 AM

david wrote:
> Code:
> #include <iostream>
> #include <cstdarg>
> #include <cstdio>
> #include <string>
> #include <sstream>
> #include <exception>
> #include "aibe.h"
> 
> class DoesNotExistInSet : public std::exception {
>     public:
>         DoesNotExistInSet(std::string helpText = "Niekas") :
> msg(helpText) {}
>         ~DoesNotExistInSet() throw() {}
>         virtual const char* what() const throw() {
>             return msg.c_str();
>         }
>     protected:
>         std::string msg;
> };
> 
> class AlreadyExistInSet : public DoesNotExitInSet { // 20
>     public:
>         AlreadyExistInSet(std::string helpText = "Niekas") :
> DoesNotExistInSet(helpText) {} // 22
>         ~AlreadyExistInSet() throw() {}
> };
> 
> aibe.cpp:20: error: expected class-name before ‘{’ token
> aibe.cpp: In constructor
> ‘AlreadyExistInSet::AlreadyExistInSet(std::string)’:
> aibe.cpp:22: error: type ‘class DoesNotExistInSet’ is not a direct
> base of ‘AlreadyExistInSet’
> 
> Started to learn more about C++ and wanted to create some specific
> exception and run into problems.
> Any ideas how to fix and why I am getting those errors?
> 

Yeah, correct the typo on line 20.
 




 2 Posts in Topic:
inheritance
david <David.Abdurachm  2008-05-12 08:12:12 
Re: inheritance
red floyd <no.spam@[EM  2008-05-12 08:46:05 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 2:59:15 CDT 2008.