tag:blogger.com,1999:blog-497028176795469611.post8814428809074132566..comments2014-07-28T18:20:06.847-07:00Comments on C++ Conceptual Questions: Rickyhttp://www.blogger.com/profile/01205947990660418412noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-497028176795469611.post-35769152991639245262012-11-07T19:31:26.592-08:002012-11-07T19:31:26.592-08:00Hi Kaush.rasto,
It is allowed to pass an argument...Hi Kaush.rasto,<br /><br />It is allowed to pass an argument to a function, as object is created so this pointer exists for the object created.<br />For example:<br />Following code is valid too.....<br />class<br />{<br />public:<br /> void setValue(int value)<br /> {<br /> m_data = value;<br /> }<br /> void display()<br /> {<br /> std::cout<<"Display function without any class name"<<"\n Value is : "<<m_data;<br /> }<br />private:<br /> int m_data;<br />}classWithoutAnyName;<br /><br />int main()<br />{<br /> classWithoutAnyName.setValue(20);<br /> classWithoutAnyName.display();<br />}Rickyhttps://www.blogger.com/profile/01205947990660418412noreply@blogger.comtag:blogger.com,1999:blog-497028176795469611.post-7008749181802387932012-11-07T10:04:20.943-08:002012-11-07T10:04:20.943-08:00Quoting "Passing Arguments to Function :
Cant...Quoting "Passing Arguments to Function :<br />Cant be done . Although we can always pass a void* . But the class won't know how to handle it"<br /><br />Can you please explain? If you are allowed to pass a void*, then you can definitely know how to handle it... isn't it? शुक्ल राहुलhttps://www.blogger.com/profile/16395125831747328255noreply@blogger.comtag:blogger.com,1999:blog-497028176795469611.post-70629720477979810032012-10-29T03:37:29.747-07:002012-10-29T03:37:29.747-07:00We can have a class without a name in C++ .
Obje...We can have a class without a name in C++ . <br /><br />Object Creation :<br />Objects of such a class can be created along with the class definition as shown above .<br /><br />Passing Arguments to Function :<br />Cant be done . Although we can always pass a void* . But the class won't know how to handle it .<br /><br />Constructors and Destructors :<br />Such a class cant have any .<br />M@dHorSehttps://www.blogger.com/profile/14094213935893591578noreply@blogger.com