Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Replying to C++: Basic Classes


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

vistz

Posted 25 October 2010 - 11:16 PM

By the way, the pointer thing is one of the most inportant functionalities in C and C++.

And I also know that allocating memory is also an important factor

yordan

Posted 29 September 2010 - 08:58 AM

Of course, there's the addition of pointers that I have to worry about also.

By the way, the pointer thing is one of the most inportant functionalities in C and C++.

vistz

Posted 28 September 2010 - 03:50 PM

Although I haven't done extensive programming in C++, I have found that many of the practices in Java are also implemented in C++. Of course, there's the addition of pointers that I have to worry about also.

Posted 11 December 2009 - 12:28 PM

struct/class difference correctionC++: Basic ClassesA struct is not the "exact same" as a public classFrom C++ standard (11.2.2):"In absence of an access-specifier for a base class, public is assumed when the derived class is declared struct and private is assumed when the class is declared class."Additionally, (11.2):"Member of a class defined with the keyword class are private by default. Members of a class defined with the keywords struct or union are public by default."-reply by richard

Posted 17 May 2009 - 05:40 PM

Thanks u very much ^^. Your notes are very useful for me. I wish all Learn programming books had clear ideals like yours. You make me to love C++ so more!

-reply by Thang Doan Minh

Gr33nN1nj4

Posted 11 August 2008 - 06:02 AM

Access private member function without using friend class

C++: Basic Classes
I want to use private member function in other class , how can I access without using friend.

-question by Aijaz Ahmad


You can't as that is the idea behind private functions/variables, think of them as globals but only for that class. What you could do(assuming you have access to the source) is create a public "proxy" function think simply passes the given variables to the private function. For private variables I would recommend implanting get/set functions.

example of a get/set
class MyClass
{
	public:
		MyClass() // :) never forget to initialize your values.. bad things will happen if you don't
		{
			number = 0;
		}

		virtual int get_number() // Returns the value of the private member number
		{
			return number;
		} 

		virtual void set_number(int value) // Sets number to equal value
		{
			number = value;
		}

	private:
		int number;
};

Posted 09 May 2008 - 07:58 AM

Access private member function without using friend class
C++: Basic Classes

I want to use private member function in other class , how can I access without using friend.

-question by Aijaz Ahmad

Posted 30 January 2008 - 01:15 PM

Thanks...
Very simple illustrations...!

-venkatraman.S

qwijibow

Posted 28 February 2007 - 01:36 PM

And Dont forget to end the class with a semi colon ';'

class
{
};

;)

quinciest

Posted 01 February 2007 - 04:57 AM

thanks for the tutorial
although i've read it in book
but i more understand read this one

Review the complete topic (launches new window)