C Language Programming notes

Source: Internet
Author: User

1, constructor initialization list:

Cmcurveex::cmcurveex (const mat& srcimg1f, float maxorntdif): M_maxangdif (MAXORNTDIF), m_img1f (srcimg1f)
{
	Cv_assert (srcimg1f.type () = = CV_32FC1);
	M_h = m_img1f.rows;
	M_w = M_img1f.cols;

	M_pder1f.create (M_h, M_w, CV_32FC1);
	M_pornt1f.create (M_h, M_w, CV_32FC1);
	M_plabel1i.create (M_h, M_w, CV_32SC1);
	M_pnext1i.create (M_h, M_w, CV_32SC1);
} </span>
In the definition of a class parameter, there is such a definition:

Class Cmcurveex
{public
:
const Mat &m_img1f;//Input image
float m_maxangdif;//  Maximum allowable angular difference in a curve
}</span>
This is the initialization list operation when writing the constructor of a class, unlike multiple inheritance of a class, where multiple inheritance of a class is:

Class Name: base Class A, base class B

{

.........

}

The syntax for the constructor initialization list is this:

Constructor (): Class parameter A (initialization value), class parameter B (initialization value)

{

................

}

The constructor initialization list is initialized to class members.

Constructors must be initialized with a list of three scenarios,
1. Data members that need to be initialized are objects (call the base class constructor when inheriting)
2. Class members that require the initialization of the const modifier
3. Require initialization of reference member data


2,cv_assert (srcimg1f.type () = = CV_32FC1);

This is an assertion that, if false in parentheses, throws an error and terminates the program, otherwise it works.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.