-2

how this thing works.

class Car
{
 public:
 Car() = default; 
 Car(const Car& other) = delete; 
 Car& operator=(const Car& other) = delete; 
 virtual void WhatsTheMake() = 0; 
 virtual void WhatsTheSpeed() =0; 
}

Now what does this delete keyword mean here?

Also does using abstract class increase code size. I mean if I don't need an Abstract class, do I always have to create it ?

Shrey
  • 1
  • 4
    They are [*deleted functions*](http://en.cppreference.com/w/cpp/language/function#Deleted_functions). – Some programmer dude Dec 07 '17 at 09:02
  • If you don't need to use it so yes, obviously it would be redundant. about **delete** - it means you explicitly delete function definition – Green Dec 07 '17 at 09:03

1 Answers1

1

If you mark a function as deleted ( = delete), any use of it will generate a compile error.

Regarding the code size, actually yes, defining an abstract class will generated more code for managing the pure virtual call (Declaring abstract class (pure virtual method) increase binary size substantially)

Personally I use an abstract class when I need to define a common base interface and I don't want to provide any common implementation and I want to delegate the implementation to the concrete classes which will inherit from (https://en.wikipedia.org/wiki/Polymorphism_(computer_science)#Subtyping)