Author Topic: Constructor and Destructor types  (Read 14940 times)

faisal

  • Newbie
  • *
  • Posts: 5
    • View Profile
Constructor and Destructor types
« on: January 07, 2021, 03:23:14 PM »
What is null constructor and full constructor? Can we have different types of constructors? When shall we use them in recommended way?
Followup question: Can we have a virtual destructor in the interface .h file like:
Code: [Select]
//destructor
  virtual ~Someclass( ) ;

I can refer to some code examples if required.
« Last Edit: January 07, 2021, 03:25:24 PM by faisal »

fmk

  • Administrator
  • Full Member
  • *****
  • Posts: 233
    • View Profile
Re: Constructor and Destructor types
« Reply #1 on: January 08, 2021, 04:48:52 PM »
a null constructor has 0 arguments, others have a number of arguments. a single class can have multiple constructors that take different types and numbers of arguments.
you can .. you only need the virtual destructors if you are envisioing a subclass