+ Reply to Thread
Results 1 to 2 of 2

Thread: What is conversion constructor in C++?

  1. #1

    What is conversion constructor in C++?

    What is conversion constructor in C++?

    How to use it?

  2. #2
    Class allows one conversion constructor.

    Following example shows how user can assign integer value to a class object, this is the feature called conversion constructor:

    Code:
    class ConversionConstructor
    {
    	int m_nData ;
    public:
    	ConversionConstructor(int nData)
    	{
    		m_nData = nData ;
    	}
    } ;
    
    void UseConversionContsructor()
    {
    	ConversionConstructor objConversionConstructor = 10 ;
    }
    Enjoy.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

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