What are the various access specifiers in c++?
Answer / Seema Pal
In C++, there are three access specifiers: private (denoted by 'private:' or just 'private'), protected (denoted by 'protected' or 'protected:'), and public (denoted by 'public').nn1) Private: Variables and functions marked as private can only be accessed within the class.n2) Protected: Variables and functions marked as protected can be accessed by the member functions of the class, its derived classes, and friend classes.n3) Public: Variables and functions marked as public can be accessed from anywhere in the program.
| Is This Answer Correct ? | 0 Yes | 0 No |
What does return 0 do in c++?
Is multimap sorted c++?
Write a program to concatenate two strings.
What is a mutex and a critical section.Whats difference between them?How do each of them work?
What is a forward referencing and when should it be used?
What is the use of register keyword with the variables?
what is COPY CONSTRUCTOR and what is it used for?
can any one help to find a specific string between html tags which is changed to a sting.. weather.html looks (for location) is <location>somewhere</location> #include <iostream> #include <fstream> #include <string> using namespace std; string find_field(string myPage,string); int main (void) { string page, line, location, temperature; ifstream inputFile("weather.xml"); while(getline(inputFile, line)) { page.append(line); line.erase(); } // Now page is a string that contains the whole xml page // Here you need to write something that finds and // extracts location and temperature from the XML // data in the string page and stores them in // the strings location and temperature respectively location=find_field(page,"location"); temperature=find_field(page,"temp_c"); cout << "Location: "<<location << endl; cout << "Temperature: " << temperature << endl; system("pause"); } string find_field(string myPage,string find_string){ int temp=myPage.find(find_string); if(temp!=string::npos) { cout << "Match found at " << temp << endl; } return "found?"; } ///
What is the best way to declare and define global variables?
What are the basics concepts of OOPS?
What is a constructor and how is it called?
What is the correct syntax for inheritance a) class aclass : public superclass b) class aclass inherit superclass c) class aclass <-superclass