Perfect24u
  • Home
  • KPK
    • KPK TEXTBOOK
      • Grade 1 KPK Textbook (KPK)
      • Grade 2 KPK Textbook Board
      • Grade 3 KPTBB
      • Grade 4 KPTBB
      • Grade 5 KPTBB
      • Grade 6 KPTBB
      • Grade 7 KPTBB
      • Grade 8 KPTBB
      • Grade 9 KPTBB
      • Grade 10 KPTBB Textbook
      • Grade 12 books for KPK
      • Grade 11 BOOK KPK Board
    • Class 4 Notes KPK
    • Class 5 KPK Notes
    • Class 6 Notes (kpk)
    • Class 7 KPK Notes
    • Class 8 KPK Notes
    • Class 9 KPK Notes
      • Mathematics
      • English Class 9 Notes for KPK
      • 9th Urdu Notes
      • Biology 9th
      • Islamiat 9
      • Computer Science 9th
      • Pak Studies 9
      • Physics 9th
      • Chemistry 9th
    • Class 10 KPK Notes
      • Mutalae Quran -e- Hakeem 10th
      • Bio Class 10 Notes KPK
      • Physics Class 10 Notes KPK
      • English 10th Notes
      • CHEMISTRY 10 NOTES
      • class 10 Maths
      • Iskamic Education Grade 10 KPK
      • General Mathematics Grade X kpk
      • Pak Study 10th
      • Urdu 10
    • Class 11 KPK Notes
      • Urdu Notes Grade XI, 1st Year for KPK
      • Islamic Education Notes KPK
      • Biology Notes 1st Year Kpk
      • 1st Year Kpk Mutale Quran Notes
      • Islamic Education Notes KPK
      • 1st Year computer Science KPK Notes
      • 1st Year Mathematics Notes
      • BISEP ICS G11
      • chemistry class 11 notes
      • English FA Fsc Part 1 KPK
      • Islamiat Class 11 for kpk
      • Physics class 11 notes
    • 2nd Years KPK Notes
      • 2nd Year Chemistry Notes
      • Bio Class 12 KPK Notes
      • Urdu Class 12 KPK Notes
      • Mathematics-XII
      • 2nd year computer science notes
      • 2nd Year Economics Notes
      • 2nd year English notes
      • 2nd year Pakistan Study Notes
      • 2nd Year Physics Notes
    • BISE Swat
      • Model Papers
      • Chemistry Class 10 Notes
      • Class 11 Computer Science
      • Economics Notes Class 11
      • Statistics Class 11
      • Class 12 Statistics Notes
    • Syllabus
    • Mardan Board
      • 9th Notes
    • Shams Notes
      • Class 9 Shams Notes, Guide
      • Class 10 Shams Notes
  • AIOU
    • B.ED books
    • M.ED
    • M.PHIL
    • B.S AIOU Books
    • M.SC
    • MBA
    • Matric Aiou
    • Bachelor AIOU Books
    • CT AIOU Books
    • M.SC
    • M.PHIL
    • FA
    • M.COM
    • P.HD
    • MPA EXECUTIVE
    • B.S AIOU Books
    • MSC. ADMINISTRATIVE SCIENCES
    • M.A Aiou Soft Books
      • M.A (LIB.SCI)
      • MA HISTORY
      • M.A (E.P.M)
      • MA SPECIAL EDUCATION
      • M.A (TEFL/ DIP)
      • MA ARABIC
      • M.A (EDU)
      • M.A Islamic Study
      • MA (URDU)
  • BISE Lahore
    • Class X
      • English Class 10th Notes
    • Class IX
      • English Class 9th Notes
    • Class XI
      • English Class 11th Notes
    • Class XII
      • English Class 12th Notes
  • Sindh Board
    • Sindh Textbook Jamshoro
      • STBB CLASS 1 BOOKS
      • STBB CLASS 2 BOOKS
      • STBB CLASS 3 BOOKS
      • STBB CLASS 4 BOOKS
      • STBB CLASS 5 BOOKS
      • STBB CLASS 6 BOOKS
      • STBB CLASS 7 BOOKS
      • STBB CLASS 8 BOOKS
      • STBB CLASS 9 BOOKS
      • STBB CLASS 10 BOOKS
      • STBB CLASS 12 BOOKS
    • Class 5 Notes All Subjects Sindh Board
      • Science Notes Class 5 Sindh
      • English Notes Class 5 sindh
      • Sindhi Class 5
      • Urdu Notes Grade V Sindh
      • Pak Study Notes Grade V Sindh
    • 6th Class Notes, Guide Sindh Board
      • Islamia Notes, Grade VI, 6th Sindh
      • Mathematics Notes Class 6th sindh
      • Sindhi Medium Class 6th
      • Urdu 6th Class Sindh
      • Social Studies Grade vi notes
      • G Science Guide Notes sindh Grade Six
      • English Grade 6 Notes Sindh
    • 7th Class Notes Sindh Board
      • Islamiat G VII Sindh
      • Urdu Grade VII Sindh
      • English 7 Class Notes Sindh
      • Arabic Notes Grade VII Sindh
      • Sindhi Grade VII
      • G Science 7 Class Sindh Notes
      • Social Studies Notes Grade VII Sindh
      • Mathematics Grade VII Sindh
    • Class 8th Notes for Sindh Board
      • Islamiat Notes Grade VIII Sindh
      • Arabic Notes Grade VIII Sindh
      • Urdu Grade VIII Notes Sindh
      • G Science Grade VIII Sindh Notes
      • English Class 8th Notes Sindh
      • General Science Grade 8th Sindh
      • Mathematics Grade VIII Notes Sindh
      • Sindhi Notes Grade VIII
    • Class IX
      • Pak Studies Sindh 9
      • Urdu Sindh class 9 notes
      • Class 9 Sindh General Mathematics Notes
      • Grade IX, Class 9th Civics Notes
      • Economic Grade ix
      • Computer Science 9 Sindh
      • Mathematic Sindh Class 9
      • Chemistry Notes
      • Biology 9
      • Physics
      • Islamic Educations Notes Gade IX Sindh
      • Sindh Board English 9th Notes
      • Islamiat Class 9 Sindh
      • Sindhi Class 9 Notes
    • Class X
      • Pak Studies Grade X, Class 10th Notes Sindh Board
      • Mathematics Grade X, 10th Notes Sindh Notes
      • Civics Notes UM Grade X, Class 10th Karachi Sindh
      • Economics C10, Grade X Sindh Board Notes
      • Islamic Education Notes Grade X Sindh Board
      • Urdu Notes Class 10 Sindh Board
      • Chemistry Grade X, Class 10th, SSc Part-2 Sindh Board
      • General Mathematics C10 Sindh
      • Economics C10, Grade X Sindh Board Notes
      • Civics Notes UM Grade X, Class 10th Karachi Sindh
      • Biology C10th Class, Grade X Notes for Sindh Board
      • Sindh Class 10 Physics
      • Sindh Class 10th English Notes
      • Islamiat Class 10 Sindh
      • MODEL QUESTION PAPERS BISE Sindh Karachi
    • Class XI
      • Urud Class 11 Sindh Notes
      • BIOLOGY SINDH 1ST YEAR
      • PHYSICS Sindh Board G11
      • Maths G11 BIEK
      • Islamic Education Notes
      • Chemistry Class 11 Notes Sindh
      • Islamiat
      • English notes class 11 Sindh board
    • Class XII
      • English Notes Sindh board 12th
      • Urdu Notes 2nd Year Sindh
      • Pak study 2nd Year Sindh Board
      • Biology F.Sc. Part-II 2nd Years Sindh Board
      • 2nd Year Chemistry Notes Sindh Board Pdf
      • Mathematics Class 12 Sindh
      • Grade 12 Sindh Physics
  • CBSE
    • CBSE Class 9
    • CBSE Class 10
    • CBSE Class 11
    • CBSE Class 12
  • Rawalpindi
    • Class 9th
      • Chemistry G9
      • Mathematics G9
      • Pak Studies G9
      • G9 Urdu
      • English 9th Notes
      • Biology G9
      • Physics G9
    • Class 10th
      • English 10th Notes
    • Class 11th
      • English 11th Notes
  • FBISE
    • Text Books (Federal)
    • 9 Class
      • Chemistry Class IX
      • Biology Notes
      • Physics IX
      • 9th FBISE Maths
      • Islamiat EM FBISE
      • FBISE PAK STUDY 9
      • Computer Science
      • FBISE URDU CLASS IX
      • Fbise 9 Notes Eng
    • 10 Class Federal Board Notes
      • Computer Grade X (Fbise) Notes
      • Islamiat Notes 10th (Fbise)
      • Pak Studies (Fbise) Notes Grade X
      • Physics Notes Grade X (Fbise)
      • Fbise Grade X Maths Notes
      • English FBISE Notes
      • BIOLOGY X
      • Chemistry (fbise) Notes Grade X
    • 11 Class
      • FBISE English 11th
      • Physics Notes 1st Year Fbise
      • Biology 1st Year Fbise
      • Islamiat Notes 1st Year Fbise
      • Math Notes 1st Year Fbise
      • Urdu 1st Year Fbise Notes
      • Chemistry Fbise Notes Grade XI
      • Computer Science
    • 12 Class
      • Class 12 English Notes Fbise
      • Business Statistics Grade XII Notes (Fbise)
      • Fbise Class XII Pakistan Studies Notes
      • Computer Sci Notes for Fbise 2nd Years
      • Fsc Chemistry 2nd Years (fbise) Notes
      • Urdu Notes Grade XII (Fbise)
      • Grade XII Mathematics Fbise Notes
      • Biology Notes (fbise) 2nd Years
      • Physics Notes (Fbise) 2nd Years
    • FBISE Past Papers
      • 10 Class Federal Board Notes
      • 9th Past Papers
  • Articles
    • Essay
    • Admissions
    • Happy Teacher Day
    • Insurance
    • Islamic
    • Speeches
    • Story
    • DIT
    • DAE
    • MCQs
  • Punjab
    • PTBB All Class Books Pdf
      • Class 5 PCTB Textbook All Subjects
      • Class 6 PCTB All Books in Pdf
      • Grade VII All Books PCTB
      • Class 8 All Book PCTB
      • Class 9 Punjab Board Textbook
      • Grade X, Class 10 Matric Textbook for Pctb
      • Class 11 Textbooks Punjab Board
      • 2nd Years PCTB All Subjects
    • Class 11 Notes PTBB
      • Computer Science PTBB Class 11
      • English 11 Notes Punjab
      • Chemsitry PTBB 11th
      • Math Notes PTBB 11th
      • Physics PTBB 11th
      • Urdu PTBB 11th
      • Biology 11th PTBB
    • Class 9 Punjab Board Notes All Subjects (PCTB)
    • Class 10th All Subjects Notes Punjab Board
    • Punjab Board Class 10 Chemistry
    • Class 12 Punjab Notes All Subjects
  • Novels
    • Islamic Based Novels
    • Urdu Novels
    • Romantic Novels
    • Areej Shah Novels
    • Umera Ahmed
    • Rude Hero Based
    • Love Story Based
    • Suspenseful Novel
    • forced marriage novels
    • Zeenia Sharjeel Novels
    • Tera Ashiq May Diwana
    • junoon e ulfat
    • Motivational Based Novels
    • Village Based
    • Innocent Heroine Based
    • Revenge Based Novels
    • Second Marriage Based
    • Digest
    • Strong Heroin Based
  • KIPS BOOKS PDF
  • Islamia Notes
    • CLASS 10 ISLAMIA NOTES
    • 2nd Years IAN
  • NAYAB NOTES
    • 1st Year Nayab Notes
    • 2nd YEARS Nayab Guide
  • Shams Notes
    • Class 10 Shams Notes
    • Class 9 Shams Notes, Guide
No Result
View All Result
  • Home
  • KPK
    • KPK TEXTBOOK
      • Grade 1 KPK Textbook (KPK)
      • Grade 2 KPK Textbook Board
      • Grade 3 KPTBB
      • Grade 4 KPTBB
      • Grade 5 KPTBB
      • Grade 6 KPTBB
      • Grade 7 KPTBB
      • Grade 8 KPTBB
      • Grade 9 KPTBB
      • Grade 10 KPTBB Textbook
      • Grade 12 books for KPK
      • Grade 11 BOOK KPK Board
    • Class 4 Notes KPK
    • Class 5 KPK Notes
    • Class 6 Notes (kpk)
    • Class 7 KPK Notes
    • Class 8 KPK Notes
    • Class 9 KPK Notes
      • Mathematics
      • English Class 9 Notes for KPK
      • 9th Urdu Notes
      • Biology 9th
      • Islamiat 9
      • Computer Science 9th
      • Pak Studies 9
      • Physics 9th
      • Chemistry 9th
    • Class 10 KPK Notes
      • Mutalae Quran -e- Hakeem 10th
      • Bio Class 10 Notes KPK
      • Physics Class 10 Notes KPK
      • English 10th Notes
      • CHEMISTRY 10 NOTES
      • class 10 Maths
      • Iskamic Education Grade 10 KPK
      • General Mathematics Grade X kpk
      • Pak Study 10th
      • Urdu 10
    • Class 11 KPK Notes
      • Urdu Notes Grade XI, 1st Year for KPK
      • Islamic Education Notes KPK
      • Biology Notes 1st Year Kpk
      • 1st Year Kpk Mutale Quran Notes
      • Islamic Education Notes KPK
      • 1st Year computer Science KPK Notes
      • 1st Year Mathematics Notes
      • BISEP ICS G11
      • chemistry class 11 notes
      • English FA Fsc Part 1 KPK
      • Islamiat Class 11 for kpk
      • Physics class 11 notes
    • 2nd Years KPK Notes
      • 2nd Year Chemistry Notes
      • Bio Class 12 KPK Notes
      • Urdu Class 12 KPK Notes
      • Mathematics-XII
      • 2nd year computer science notes
      • 2nd Year Economics Notes
      • 2nd year English notes
      • 2nd year Pakistan Study Notes
      • 2nd Year Physics Notes
    • BISE Swat
      • Model Papers
      • Chemistry Class 10 Notes
      • Class 11 Computer Science
      • Economics Notes Class 11
      • Statistics Class 11
      • Class 12 Statistics Notes
    • Syllabus
    • Mardan Board
      • 9th Notes
    • Shams Notes
      • Class 9 Shams Notes, Guide
      • Class 10 Shams Notes
  • AIOU
    • B.ED books
    • M.ED
    • M.PHIL
    • B.S AIOU Books
    • M.SC
    • MBA
    • Matric Aiou
    • Bachelor AIOU Books
    • CT AIOU Books
    • M.SC
    • M.PHIL
    • FA
    • M.COM
    • P.HD
    • MPA EXECUTIVE
    • B.S AIOU Books
    • MSC. ADMINISTRATIVE SCIENCES
    • M.A Aiou Soft Books
      • M.A (LIB.SCI)
      • MA HISTORY
      • M.A (E.P.M)
      • MA SPECIAL EDUCATION
      • M.A (TEFL/ DIP)
      • MA ARABIC
      • M.A (EDU)
      • M.A Islamic Study
      • MA (URDU)
  • BISE Lahore
    • Class X
      • English Class 10th Notes
    • Class IX
      • English Class 9th Notes
    • Class XI
      • English Class 11th Notes
    • Class XII
      • English Class 12th Notes
  • Sindh Board
    • Sindh Textbook Jamshoro
      • STBB CLASS 1 BOOKS
      • STBB CLASS 2 BOOKS
      • STBB CLASS 3 BOOKS
      • STBB CLASS 4 BOOKS
      • STBB CLASS 5 BOOKS
      • STBB CLASS 6 BOOKS
      • STBB CLASS 7 BOOKS
      • STBB CLASS 8 BOOKS
      • STBB CLASS 9 BOOKS
      • STBB CLASS 10 BOOKS
      • STBB CLASS 12 BOOKS
    • Class 5 Notes All Subjects Sindh Board
      • Science Notes Class 5 Sindh
      • English Notes Class 5 sindh
      • Sindhi Class 5
      • Urdu Notes Grade V Sindh
      • Pak Study Notes Grade V Sindh
    • 6th Class Notes, Guide Sindh Board
      • Islamia Notes, Grade VI, 6th Sindh
      • Mathematics Notes Class 6th sindh
      • Sindhi Medium Class 6th
      • Urdu 6th Class Sindh
      • Social Studies Grade vi notes
      • G Science Guide Notes sindh Grade Six
      • English Grade 6 Notes Sindh
    • 7th Class Notes Sindh Board
      • Islamiat G VII Sindh
      • Urdu Grade VII Sindh
      • English 7 Class Notes Sindh
      • Arabic Notes Grade VII Sindh
      • Sindhi Grade VII
      • G Science 7 Class Sindh Notes
      • Social Studies Notes Grade VII Sindh
      • Mathematics Grade VII Sindh
    • Class 8th Notes for Sindh Board
      • Islamiat Notes Grade VIII Sindh
      • Arabic Notes Grade VIII Sindh
      • Urdu Grade VIII Notes Sindh
      • G Science Grade VIII Sindh Notes
      • English Class 8th Notes Sindh
      • General Science Grade 8th Sindh
      • Mathematics Grade VIII Notes Sindh
      • Sindhi Notes Grade VIII
    • Class IX
      • Pak Studies Sindh 9
      • Urdu Sindh class 9 notes
      • Class 9 Sindh General Mathematics Notes
      • Grade IX, Class 9th Civics Notes
      • Economic Grade ix
      • Computer Science 9 Sindh
      • Mathematic Sindh Class 9
      • Chemistry Notes
      • Biology 9
      • Physics
      • Islamic Educations Notes Gade IX Sindh
      • Sindh Board English 9th Notes
      • Islamiat Class 9 Sindh
      • Sindhi Class 9 Notes
    • Class X
      • Pak Studies Grade X, Class 10th Notes Sindh Board
      • Mathematics Grade X, 10th Notes Sindh Notes
      • Civics Notes UM Grade X, Class 10th Karachi Sindh
      • Economics C10, Grade X Sindh Board Notes
      • Islamic Education Notes Grade X Sindh Board
      • Urdu Notes Class 10 Sindh Board
      • Chemistry Grade X, Class 10th, SSc Part-2 Sindh Board
      • General Mathematics C10 Sindh
      • Economics C10, Grade X Sindh Board Notes
      • Civics Notes UM Grade X, Class 10th Karachi Sindh
      • Biology C10th Class, Grade X Notes for Sindh Board
      • Sindh Class 10 Physics
      • Sindh Class 10th English Notes
      • Islamiat Class 10 Sindh
      • MODEL QUESTION PAPERS BISE Sindh Karachi
    • Class XI
      • Urud Class 11 Sindh Notes
      • BIOLOGY SINDH 1ST YEAR
      • PHYSICS Sindh Board G11
      • Maths G11 BIEK
      • Islamic Education Notes
      • Chemistry Class 11 Notes Sindh
      • Islamiat
      • English notes class 11 Sindh board
    • Class XII
      • English Notes Sindh board 12th
      • Urdu Notes 2nd Year Sindh
      • Pak study 2nd Year Sindh Board
      • Biology F.Sc. Part-II 2nd Years Sindh Board
      • 2nd Year Chemistry Notes Sindh Board Pdf
      • Mathematics Class 12 Sindh
      • Grade 12 Sindh Physics
  • CBSE
    • CBSE Class 9
    • CBSE Class 10
    • CBSE Class 11
    • CBSE Class 12
  • Rawalpindi
    • Class 9th
      • Chemistry G9
      • Mathematics G9
      • Pak Studies G9
      • G9 Urdu
      • English 9th Notes
      • Biology G9
      • Physics G9
    • Class 10th
      • English 10th Notes
    • Class 11th
      • English 11th Notes
  • FBISE
    • Text Books (Federal)
    • 9 Class
      • Chemistry Class IX
      • Biology Notes
      • Physics IX
      • 9th FBISE Maths
      • Islamiat EM FBISE
      • FBISE PAK STUDY 9
      • Computer Science
      • FBISE URDU CLASS IX
      • Fbise 9 Notes Eng
    • 10 Class Federal Board Notes
      • Computer Grade X (Fbise) Notes
      • Islamiat Notes 10th (Fbise)
      • Pak Studies (Fbise) Notes Grade X
      • Physics Notes Grade X (Fbise)
      • Fbise Grade X Maths Notes
      • English FBISE Notes
      • BIOLOGY X
      • Chemistry (fbise) Notes Grade X
    • 11 Class
      • FBISE English 11th
      • Physics Notes 1st Year Fbise
      • Biology 1st Year Fbise
      • Islamiat Notes 1st Year Fbise
      • Math Notes 1st Year Fbise
      • Urdu 1st Year Fbise Notes
      • Chemistry Fbise Notes Grade XI
      • Computer Science
    • 12 Class
      • Class 12 English Notes Fbise
      • Business Statistics Grade XII Notes (Fbise)
      • Fbise Class XII Pakistan Studies Notes
      • Computer Sci Notes for Fbise 2nd Years
      • Fsc Chemistry 2nd Years (fbise) Notes
      • Urdu Notes Grade XII (Fbise)
      • Grade XII Mathematics Fbise Notes
      • Biology Notes (fbise) 2nd Years
      • Physics Notes (Fbise) 2nd Years
    • FBISE Past Papers
      • 10 Class Federal Board Notes
      • 9th Past Papers
  • Articles
    • Essay
    • Admissions
    • Happy Teacher Day
    • Insurance
    • Islamic
    • Speeches
    • Story
    • DIT
    • DAE
    • MCQs
  • Punjab
    • PTBB All Class Books Pdf
      • Class 5 PCTB Textbook All Subjects
      • Class 6 PCTB All Books in Pdf
      • Grade VII All Books PCTB
      • Class 8 All Book PCTB
      • Class 9 Punjab Board Textbook
      • Grade X, Class 10 Matric Textbook for Pctb
      • Class 11 Textbooks Punjab Board
      • 2nd Years PCTB All Subjects
    • Class 11 Notes PTBB
      • Computer Science PTBB Class 11
      • English 11 Notes Punjab
      • Chemsitry PTBB 11th
      • Math Notes PTBB 11th
      • Physics PTBB 11th
      • Urdu PTBB 11th
      • Biology 11th PTBB
    • Class 9 Punjab Board Notes All Subjects (PCTB)
    • Class 10th All Subjects Notes Punjab Board
    • Punjab Board Class 10 Chemistry
    • Class 12 Punjab Notes All Subjects
  • Novels
    • Islamic Based Novels
    • Urdu Novels
    • Romantic Novels
    • Areej Shah Novels
    • Umera Ahmed
    • Rude Hero Based
    • Love Story Based
    • Suspenseful Novel
    • forced marriage novels
    • Zeenia Sharjeel Novels
    • Tera Ashiq May Diwana
    • junoon e ulfat
    • Motivational Based Novels
    • Village Based
    • Innocent Heroine Based
    • Revenge Based Novels
    • Second Marriage Based
    • Digest
    • Strong Heroin Based
  • KIPS BOOKS PDF
  • Islamia Notes
    • CLASS 10 ISLAMIA NOTES
    • 2nd Years IAN
  • NAYAB NOTES
    • 1st Year Nayab Notes
    • 2nd YEARS Nayab Guide
  • Shams Notes
    • Class 10 Shams Notes
    • Class 9 Shams Notes, Guide
No Result
View All Result
Perfect24u
No Result
View All Result
Home KPK NOTES 2nd Years KPK Notes 2nd year computer science notes

2nd year Computer Science Notes Chapter 8 Objects and Classes

20k
SHARES
20k
VIEWS
Share on WhatsApp FacebookShare on Twitter

2nd year Computer Science Notes Chapter 8 Objects and Classes khyber pakhtunkhwa textbook board Peshawar Computer science book notes pdf download now.

Computer Science Notes Chapter 8 Objects and Classes

Q.4) Write a C++ program implementing a class with the name Circle having two functions with the names: GatRadius and CalArea. The functions should get the value for the radius from the user and then calculate the area of the circle and display the result.

Answer:
class Circle
{
public:
        int GetRadius()
        {
                int radius;
                cout << “Enter Radius of the circle :”;
                cin >> radius;
                return radius;
        }
        double CalArea(double p, double radius)
        {
                double area = p * radius * radius;
                return area;
        }
};

int main()
{
        Circle c;
        int r = c.GetRadius();
        double p = 3.14;
        cout << “Area of Circle is : ” << c.CalArea(p, r) << endl;
        return 0;
}
Output:
The output of the above program is as follows:

sdafa Perfect Notes 24U

Q.5) Write a C++ program implementing inheritance between Employee (base class) and Manager (derived class).

Answer:
class Employee
{
public:
        void getBasicInfo()
        {
                cout << “– BASIC INFORMATION –\n”;
                cout << “Name    : Adeel Raheem.”;
                cout << endl;
                cout << “Emp. Id : 2206”;
                cout << endl;
                cout << “Gender  : M”;    
                cout << endl;
        }

        void getDepartment()
        {
                string department;
                cout << “– DEPT. INFORMATION –\n”;
                cout << “Department Name : HR\n”;
                cout << “Designation     : Manager\n”;
                cout << “Working Hours   : 16 hrs/day\n\n”;
        }
};

class Manager : public Employee
{
public:
        void display()
        {
                getBasicInfo();
                cout << “\n\n\n\n”;
                getDepartment();
        }
};
        int main()
        {
                char c;
                Manager m;
                cout << “Do you want to get Employee Information? Select Y/N :”;
                cin >> c;
                cout << “\n\n”;
                if (c == ‘Y’)
                {
                        m.display();
                }
                else if (c == ‘N’)
                {
                        cout << “\nNothing To Display”;
                }
                else
                {
                        cout << “\nInvalid Selection”;
                }
}
Output:
The output of the program is as follows:

cfcc Perfect Notes 24U

Q.6) Diagrammatically represent the following scenario of inheritance:

  • We have Shape as a base class and Circle, Rectangle, Triangle and square as its derived classes.

dffgdgfd Perfect Notes 24U

Q.7) Write a C++ program implementing a class with the name ConstDest having constructor and destructor functions in its body.

Answer:
class ConstDest
{
public:
ConstDest()
{
cout << “I am a Constructor” << endl;
}
~ConstDest()
{
cout << “I am a Destructor” << endl;
}
};
int main()
{
ConstDest c1;
_getch();
return 0;
}
Output:
The output of the program is as follows:

T66fFKITQ6UcFQp lmjTHe7qg3ak9TLa Perfect Notes 24U

Q.8) Write a C++ program implementing a class with the name Time. This class should have a constructor to initialize the time, hours, minutes and seconds. The class should have another function named ToSecond() to convert and display the time into seconds.

Answer:
class Time
{
    private:
        int seconds;
        int hh, mm, ss;
    public:
            void getTime(void);
            void convertIntoSeconds(void);
            void displayTime(void);
};

void Time::getTime(void)
{
            cout << “Enter time:” << endl;
            cout << “Hours?   “;          cin >> hh;
            cout << “Minutes? “;          cin >> mm;
            cout << “Seconds? “;          cin >> ss;
}

void Time::convertIntoSeconds(void)
{
            seconds = hh * 3600 + mm * 60 + ss;
}

void Time::displayTime(void)
{
            cout << “Time in total seconds: ” << seconds<<“\n\n”;
}

int main()
{
            Time T;

            T.getTime();
            T.convertIntoSeconds();
            T.displayTime();

            return 0;
}
Output:
The output of the program is as follows:

hfgd Perfect Notes 24U

Q.9) What is object? How objects are created to access members of a class?

Answer:
OBJECT
DEFINITION:

“Objects are instances of the class, which holds the data variables declared in the class and the member functions work on these class objects. In other words, a variable of type class is called an object.”
EXPLANATION:
In C++, when we declare a variable of type class, we call it instantiating (from the instance,) the class and the variable itself is called an instance or object of that class. The object is of great importance in OOP, because, a class cannot be used without creating its object.
GENERAL FORM:
The general syntax for creating an object of a class is given below.
Class_name Object_name;
Thus, for the above class CRectangle, the object can be created as follows:
CRectangle R1; II R1 is the object of class CRectangle
We can also create more than one object in a single statement like:
CRectangle R1, R2, R3;
EXPLANATION OF GENERAL FORM:
Here, R1, R2, R3 are the objects of the same class CRectangle that share the same data member and member functions. The definition of a class does not occupy any memory. It only defines what the class looks like. In order to use a class, a variable of that class type must be declared. When an object is created then memory is set aside for all the data members and member functions of that class.
EXAMPLE:
Consider the following program to implement the class CRectangle discussed above.        
#include “stdafx.h”
#include <iostream>
#include<conio.h>
using namespace std;
class CRectangle
{
private:
    int X, Y;
public:
    void set_values(int a, int b)
    {
        X = a;
        Y = b;
    }
    int area()
    {
        cout << “Area of the rectangle = ” << (X*Y);
        return 0;
    }
}; //End of class
int main()
{
    CRectangle R1; // Object creation
    R1.set_values(44, 22); //call to set_values function
    R1.area(); // call to area function
    _getch();
    return 0;
}
EXPLANATION OF PROGRAM:
In this program the member function set-values and area are accessed by R1 .set-values(44,22) and R.area().
OUTPUT:
The output of the above example is as follows:

ghf Perfect Notes 24U

Q.10) Explain inheritance and polymorphism with examples.

Answer:
Inheritance
Definition:
“Acquiring some of the common qualities from parents (for instance eyes like mother, hair-like father, etc) is called inheritance.”
A new model car having some inherited features from the old model, like the brake system and navigation system, etc.
Example:
class Employee
{
public:
        void getBasicInfo()
        {
                cout << “– BASIC INFORMATION –\n”;
                cout << “Name    : Adeel Raheem.”;
                cout << endl;
                cout << “Emp. Id : 2206”;
                cout << endl;
                cout << “Gender  : M”;    
                cout << endl;
        }

        void getDepartment()
        {
                string department;
                cout << “– DEPT. INFORMATION –\n”;
                cout << “Department Name : HR\n”;
                cout << “Designation     : Manager\n”;
                cout << “Working Hours   : 16 hrs/day\n\n”;
        }
};

class Manager : public Employee
{
public:
        void display()
        {
                getBasicInfo();
                cout << “\n\n\n\n”;
                getDepartment();
        }
};
        int main()
        {
                char c;
                Manager m;
                cout << “Do you want to get Employee Information? Select Y/N :”;
                cin >> c;
                cout << “\n\n”;
                if (c == ‘Y’)
                {
                        m.display();
                }
                else if (c == ‘N’)
                {
                        cout << “\nNothing To Display”;
                }
                else
                {
                        cout << “\nInvalid Selection”;
                }
}
Output:
The output of the program is as follows:

fdgf Perfect Notes 24U

Polymorphism
Definition:
“It is the ability to use an operator or function in multiple ways.”
It means multiple possible states for a single property. For example, a person can be a student as well as a friend to another person. Also, a person can be an engineer as well as a teacher.
In C++ polymorphism can be achieved by one of the following concepts:
–    Function overloading
–    Operator overloading
–    Virtual functions
Example:
Consider the following example:
6 + 10;
The above statement refers to integer addition with the help of ‘+’ operator. The same operator can be used for adding the floating point numbers. Or it can be used for concatenation of strings. They are as follows:
7.15 + 3.78
“Computer” + “Training”
The above concept is known as operating overloading.


Reated Post:

  • 2nd-year computer science notes Chapter 1 Operating Systems
  • 2nd-year computer science notes Chapter 2 System Development Life Cycle
  • Computer Science Notes Chapter 5 Arrays and Strings
  • Chapter 3 Object-Oriented Programming using C++
  • 2nd year Computer science Notes Chapter 4 Control Structures
  • Computer Science Notes Chapter 7 Pointers
SendShare8000Tweet5000Pin1804Share1400ShareShareShare
Previous Post

2nd Year Computer Science Notes Chapter 7 Pointers

Next Post

Class 12 Computer Science Notes for KPK Chapter 9 File Handling

Related Posts

KPK G12 Computer Science Notes Chapter 6 (Functions)

KPK G12 Computer Science Notes Chapter 6 (Functions)

March 30, 2024
Best 2nd Year Computer Science Notes of All Chapters

Best 2nd Year Computer Science Notes of All Chapters

June 4, 2024
Class 12 Computer Science Notes for KPK Chapter 9 File Handling

Class 12 Computer Science Notes for KPK Chapter 9 File Handling

March 30, 2024
2nd Year Computer Science Notes Chapter 7 Pointers

2nd Year Computer Science Notes Chapter 7 Pointers

March 30, 2024
Chapter 5 Arrays and Strings

2nd Year Computer Science Notes Chapter 5 Arrays and Strings

April 13, 2024
2nd year Computer science Notes Chapter 4 Control Structures

2nd year Computer science Notes Cha 4 Control Structures

April 13, 2024
Chapter 3 Object Oriented Programming using C++

Chapter 3 Object Oriented Programming using C++

March 30, 2024
System Development Life Cycle

2nd year computer science notes Chapter 2 System Development Life Cycle

March 30, 2024
Please login to join discussion

Guest Post Service

Guest Post Service Available contact: fakhrealamin0@gmail.com

 

  • Home
  • Privacy Policy
  • Contact Us
  • Feedback
  • Disclaimer
  • T&C
  • Cookies Policy
  • Guest Post Service

© 2024 Perfect24u

No Result
View All Result
  • Home
  • KPK
    • KPK TEXTBOOK
      • Grade 1 KPK Textbook (KPK)
      • Grade 2 KPK Textbook Board
      • Grade 3 KPTBB
      • Grade 4 KPTBB
      • Grade 5 KPTBB
      • Grade 6 KPTBB
      • Grade 7 KPTBB
      • Grade 8 KPTBB
      • Grade 9 KPTBB
      • Grade 10 KPTBB Textbook
      • Grade 12 books for KPK
      • Grade 11 BOOK KPK Board
    • Class 4 Notes KPK
    • Class 5 KPK Notes
    • Class 6 Notes (kpk)
    • Class 7 KPK Notes
    • Class 8 KPK Notes
    • Class 9 KPK Notes
      • Mathematics
      • English Class 9 Notes for KPK
      • 9th Urdu Notes
      • Biology 9th
      • Islamiat 9
      • Computer Science 9th
      • Pak Studies 9
      • Physics 9th
      • Chemistry 9th
    • Class 10 KPK Notes
      • Mutalae Quran -e- Hakeem 10th
      • Bio Class 10 Notes KPK
      • Physics Class 10 Notes KPK
      • English 10th Notes
      • CHEMISTRY 10 NOTES
      • class 10 Maths
      • Iskamic Education Grade 10 KPK
      • General Mathematics Grade X kpk
      • Pak Study 10th
      • Urdu 10
    • Class 11 KPK Notes
      • Urdu Notes Grade XI, 1st Year for KPK
      • Islamic Education Notes KPK
      • Biology Notes 1st Year Kpk
      • 1st Year Kpk Mutale Quran Notes
      • Islamic Education Notes KPK
      • 1st Year computer Science KPK Notes
      • 1st Year Mathematics Notes
      • BISEP ICS G11
      • chemistry class 11 notes
      • English FA Fsc Part 1 KPK
      • Islamiat Class 11 for kpk
      • Physics class 11 notes
    • 2nd Years KPK Notes
      • 2nd Year Chemistry Notes
      • Bio Class 12 KPK Notes
      • Urdu Class 12 KPK Notes
      • Mathematics-XII
      • 2nd year computer science notes
      • 2nd Year Economics Notes
      • 2nd year English notes
      • 2nd year Pakistan Study Notes
      • 2nd Year Physics Notes
    • BISE Swat
      • Model Papers
      • Chemistry Class 10 Notes
      • Class 11 Computer Science
      • Economics Notes Class 11
      • Statistics Class 11
      • Class 12 Statistics Notes
    • Syllabus
    • Mardan Board
      • 9th Notes
    • Shams Notes
      • Class 9 Shams Notes, Guide
      • Class 10 Shams Notes
  • AIOU
    • B.ED books
    • M.ED
    • M.PHIL
    • B.S AIOU Books
    • M.SC
    • MBA
    • Matric Aiou
    • Bachelor AIOU Books
    • CT AIOU Books
    • M.SC
    • M.PHIL
    • FA
    • M.COM
    • P.HD
    • MPA EXECUTIVE
    • B.S AIOU Books
    • MSC. ADMINISTRATIVE SCIENCES
    • M.A Aiou Soft Books
      • M.A (LIB.SCI)
      • MA HISTORY
      • M.A (E.P.M)
      • MA SPECIAL EDUCATION
      • M.A (TEFL/ DIP)
      • MA ARABIC
      • M.A (EDU)
      • M.A Islamic Study
      • MA (URDU)
  • BISE Lahore
    • Class X
      • English Class 10th Notes
    • Class IX
      • English Class 9th Notes
    • Class XI
      • English Class 11th Notes
    • Class XII
      • English Class 12th Notes
  • Sindh Board
    • Sindh Textbook Jamshoro
      • STBB CLASS 1 BOOKS
      • STBB CLASS 2 BOOKS
      • STBB CLASS 3 BOOKS
      • STBB CLASS 4 BOOKS
      • STBB CLASS 5 BOOKS
      • STBB CLASS 6 BOOKS
      • STBB CLASS 7 BOOKS
      • STBB CLASS 8 BOOKS
      • STBB CLASS 9 BOOKS
      • STBB CLASS 10 BOOKS
      • STBB CLASS 12 BOOKS
    • Class 5 Notes All Subjects Sindh Board
      • Science Notes Class 5 Sindh
      • English Notes Class 5 sindh
      • Sindhi Class 5
      • Urdu Notes Grade V Sindh
      • Pak Study Notes Grade V Sindh
    • 6th Class Notes, Guide Sindh Board
      • Islamia Notes, Grade VI, 6th Sindh
      • Mathematics Notes Class 6th sindh
      • Sindhi Medium Class 6th
      • Urdu 6th Class Sindh
      • Social Studies Grade vi notes
      • G Science Guide Notes sindh Grade Six
      • English Grade 6 Notes Sindh
    • 7th Class Notes Sindh Board
      • Islamiat G VII Sindh
      • Urdu Grade VII Sindh
      • English 7 Class Notes Sindh
      • Arabic Notes Grade VII Sindh
      • Sindhi Grade VII
      • G Science 7 Class Sindh Notes
      • Social Studies Notes Grade VII Sindh
      • Mathematics Grade VII Sindh
    • Class 8th Notes for Sindh Board
      • Islamiat Notes Grade VIII Sindh
      • Arabic Notes Grade VIII Sindh
      • Urdu Grade VIII Notes Sindh
      • G Science Grade VIII Sindh Notes
      • English Class 8th Notes Sindh
      • General Science Grade 8th Sindh
      • Mathematics Grade VIII Notes Sindh
      • Sindhi Notes Grade VIII
    • Class IX
      • Pak Studies Sindh 9
      • Urdu Sindh class 9 notes
      • Class 9 Sindh General Mathematics Notes
      • Grade IX, Class 9th Civics Notes
      • Economic Grade ix
      • Computer Science 9 Sindh
      • Mathematic Sindh Class 9
      • Chemistry Notes
      • Biology 9
      • Physics
      • Islamic Educations Notes Gade IX Sindh
      • Sindh Board English 9th Notes
      • Islamiat Class 9 Sindh
      • Sindhi Class 9 Notes
    • Class X
      • Pak Studies Grade X, Class 10th Notes Sindh Board
      • Mathematics Grade X, 10th Notes Sindh Notes
      • Civics Notes UM Grade X, Class 10th Karachi Sindh
      • Economics C10, Grade X Sindh Board Notes
      • Islamic Education Notes Grade X Sindh Board
      • Urdu Notes Class 10 Sindh Board
      • Chemistry Grade X, Class 10th, SSc Part-2 Sindh Board
      • General Mathematics C10 Sindh
      • Economics C10, Grade X Sindh Board Notes
      • Civics Notes UM Grade X, Class 10th Karachi Sindh
      • Biology C10th Class, Grade X Notes for Sindh Board
      • Sindh Class 10 Physics
      • Sindh Class 10th English Notes
      • Islamiat Class 10 Sindh
      • MODEL QUESTION PAPERS BISE Sindh Karachi
    • Class XI
      • Urud Class 11 Sindh Notes
      • BIOLOGY SINDH 1ST YEAR
      • PHYSICS Sindh Board G11
      • Maths G11 BIEK
      • Islamic Education Notes
      • Chemistry Class 11 Notes Sindh
      • Islamiat
      • English notes class 11 Sindh board
    • Class XII
      • English Notes Sindh board 12th
      • Urdu Notes 2nd Year Sindh
      • Pak study 2nd Year Sindh Board
      • Biology F.Sc. Part-II 2nd Years Sindh Board
      • 2nd Year Chemistry Notes Sindh Board Pdf
      • Mathematics Class 12 Sindh
      • Grade 12 Sindh Physics
  • CBSE
    • CBSE Class 9
    • CBSE Class 10
    • CBSE Class 11
    • CBSE Class 12
  • Rawalpindi
    • Class 9th
      • Chemistry G9
      • Mathematics G9
      • Pak Studies G9
      • G9 Urdu
      • English 9th Notes
      • Biology G9
      • Physics G9
    • Class 10th
      • English 10th Notes
    • Class 11th
      • English 11th Notes
  • FBISE
    • Text Books (Federal)
    • 9 Class
      • Chemistry Class IX
      • Biology Notes
      • Physics IX
      • 9th FBISE Maths
      • Islamiat EM FBISE
      • FBISE PAK STUDY 9
      • Computer Science
      • FBISE URDU CLASS IX
      • Fbise 9 Notes Eng
    • 10 Class Federal Board Notes
      • Computer Grade X (Fbise) Notes
      • Islamiat Notes 10th (Fbise)
      • Pak Studies (Fbise) Notes Grade X
      • Physics Notes Grade X (Fbise)
      • Fbise Grade X Maths Notes
      • English FBISE Notes
      • BIOLOGY X
      • Chemistry (fbise) Notes Grade X
    • 11 Class
      • FBISE English 11th
      • Physics Notes 1st Year Fbise
      • Biology 1st Year Fbise
      • Islamiat Notes 1st Year Fbise
      • Math Notes 1st Year Fbise
      • Urdu 1st Year Fbise Notes
      • Chemistry Fbise Notes Grade XI
      • Computer Science
    • 12 Class
      • Class 12 English Notes Fbise
      • Business Statistics Grade XII Notes (Fbise)
      • Fbise Class XII Pakistan Studies Notes
      • Computer Sci Notes for Fbise 2nd Years
      • Fsc Chemistry 2nd Years (fbise) Notes
      • Urdu Notes Grade XII (Fbise)
      • Grade XII Mathematics Fbise Notes
      • Biology Notes (fbise) 2nd Years
      • Physics Notes (Fbise) 2nd Years
    • FBISE Past Papers
      • 10 Class Federal Board Notes
      • 9th Past Papers
  • Articles
    • Essay
    • Admissions
    • Happy Teacher Day
    • Insurance
    • Islamic
    • Speeches
    • Story
    • DIT
    • DAE
    • MCQs
  • Punjab
    • PTBB All Class Books Pdf
      • Class 5 PCTB Textbook All Subjects
      • Class 6 PCTB All Books in Pdf
      • Grade VII All Books PCTB
      • Class 8 All Book PCTB
      • Class 9 Punjab Board Textbook
      • Grade X, Class 10 Matric Textbook for Pctb
      • Class 11 Textbooks Punjab Board
      • 2nd Years PCTB All Subjects
    • Class 11 Notes PTBB
      • Computer Science PTBB Class 11
      • English 11 Notes Punjab
      • Chemsitry PTBB 11th
      • Math Notes PTBB 11th
      • Physics PTBB 11th
      • Urdu PTBB 11th
      • Biology 11th PTBB
    • Class 9 Punjab Board Notes All Subjects (PCTB)
    • Class 10th All Subjects Notes Punjab Board
    • Punjab Board Class 10 Chemistry
    • Class 12 Punjab Notes All Subjects
  • Novels
    • Islamic Based Novels
    • Urdu Novels
    • Romantic Novels
    • Areej Shah Novels
    • Umera Ahmed
    • Rude Hero Based
    • Love Story Based
    • Suspenseful Novel
    • forced marriage novels
    • Zeenia Sharjeel Novels
    • Tera Ashiq May Diwana
    • junoon e ulfat
    • Motivational Based Novels
    • Village Based
    • Innocent Heroine Based
    • Revenge Based Novels
    • Second Marriage Based
    • Digest
    • Strong Heroin Based
  • KIPS BOOKS PDF
  • Islamia Notes
    • CLASS 10 ISLAMIA NOTES
    • 2nd Years IAN
  • NAYAB NOTES
    • 1st Year Nayab Notes
    • 2nd YEARS Nayab Guide
  • Shams Notes
    • Class 10 Shams Notes
    • Class 9 Shams Notes, Guide

© 2024 Perfect24u