Logo 
Search:

C++ Programming Articles

Submit Article
Home » Articles » C++ Programming » Homework HelpRSS Feeds

Program of class and objects using private and public data members

Posted By: Pedro Silva     Category: C++ Programming     Views: 17962

Write a program of class and objects using private and public data members.

Code for Program of class and objects using private and public data members in C++ Programming

#include<iostream.h>
#include<conio.h>
class data
{
    int day;
    int month;
    int year;
    public:
    void date(int dd,int mm,int yy)
    {
        day=dd;
        month=mm;
        year=yy;
        cout<<"\t"<<day<<endl;
        cout<<"\t"<<month<<endl;
        cout<<"\t"<<year<<endl;

    }
};

main()
{
    clrscr();
    data f1,f2;
    f1.date(7,12,2002);
    f2.date(8,12,2002);
    f1.date(12,12,2002);

}
  
Share: 



Pedro  Silva
Pedro Silva author of Program of class and objects using private and public data members is from Salvador, Brazil.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!