Sunday, July 12, 2009

Doubts in C++?

class ComplexNumberTest : public CppUnit::TestCase {


public:


ComplexNumberTest( std::string name ) : CppUnit::TestCase( name ) { }





void run{


.....


...


}


};





pls explain first three statements of the above code and what it is conveying..





pls explain about friend functions in C++ also

Doubts in C++?
first statement is declaring the class name (ComplexNumberTest ) and that it is deriving from the TestCase class in the CppUnit namespace (library).


The third statement is declaring a method in this class that is implementing an interface TestCase from the CPPUnit.


Refer: sourceforge.net/projects/cppunit for details.
Reply:I don't really know if the first line is right, but w/e I don't use classes much. What it is is a class and you can define a variable with that class, and then use any functions within that class like ComplexNumberTest on the variable defined. Idk what u mean by friend functions either, maybe theres someone else who has better experience with classes.
Reply:Why are you having doubts in C++? You have to believe in it to understand that it actually is working.





OK, OK. What you're doing is you're doing a complex number by class test. You're using the public as your test case where each person represent a number. (std=standard, == means =


I think you mistyped something here.

artificial flowers

No comments:

Post a Comment