Advertisement
Guest User

Untitled

a guest
May 13th, 2022
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. class Machine{
  2. void makeIntersection(Machine const& other)
  3. virtual someFunc()=0;
  4. }
  5.  
  6. class DFA: public Machine{
  7. }
  8.  
  9. class NFA: public Machine{
  10. }
  11.  
  12. // I WANT THIS FUNCTION TO HAVE THE ABILLITY, THAT 'Machine' CAN BE EVERY DERIVED CLASS WITHOUT WRITING THE METHOD SEPARETLY IN EVERY
  13. //DERIVED CLASS
  14. void Machine::makeIntersection(Machine const& other) //this is giving me an error because I can't construct an abstract class object
  15. {
  16.     auto test = [this, other](std::string const& a, std::string const& b)->bool
  17.     {
  18.         if (this->isFinalState(a) && other.isFinalState(b))return true;
  19.         return false;
  20.     };
  21.     this->makeStates(other, test);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement