Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Hi!!!!,I’m a new in the world of pr

Hi!!!!,I’m a new in the world of pr

Hi!!!!,I’m a new in the world of pr

Hi!!!!,I’m a new in the world of programming(C++)…I want to know about..what the meaning and the function of :-

Class base{

    void getdata();
    void display();

3)class derivedB:public base and what the different with
    symbol ::
4)and the meaning in void main()
derivedB object;

This is my program:-


class base{

int x;
int y;

void getdata();
void display();


class derivedB:public base{

int rollno;
char name[20];

void getdata();
void displaydata();


void base::getdata()



RE: Hi!!!!,I’m a new in the world of pr

Hi Visitor


there are 3 categories of access to a class
1 public the data members and functions can be accessed by any external part of the program

2 private these members can only be accessed by member functions of the class (also other class member functions that have been declared as "friend" classes of functions

3 protected used for inheritence

    void getdata();
    void display();

this means that the member functions can be called by external non member function within your code

3 :: is the scope resolution operator in other words if you have a derived class and a base class with the same function names this allows you to specify which class function you are calling base or derived

base*ptr;  // pointer to base class
derivedB object; // an instance of a derivedb object
ptr=&object; // reassiging ptr tp point to the instance   
ptr->getdata(); // now calls derived member function
ptr->display(); // again calls derived member function
getch();        // ugly not a c++ method use istream but
                // you need to learn more first

void base::getdata() // scope resolution you intend to call the base class member function...

hang in it will become clear, join the forum and enjoy


RE: Hi!!!!,I’m a new in the world of pr

Thank u very much for your explanation!!!! Robertd...i hope u can guide me to be agood programming again..and i hope we can be a member for the fortune

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close