15,911,711 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Shivam Siddharth (Top 11 by date)
Shivam Siddharth
21-Mar-23 4:16am
View
your thing worked ,but I am not using it outside its scope just passing the values like when called normally & how other variables are being accepted n and k
Shivam Siddharth
20-Mar-23 16:55pm
View
why doesn't it consider it as an input since value is being given and its type is mentioned in the declaration
Shivam Siddharth
7-Jan-23 11:24am
View
using recursion for eg step 2 in which value is 2 will also recurse for value 1 also which i don't want to happen and if i put a 'if' condition to stop that from happening step 3 won't be executed
how should i get the desired output
Shivam Siddharth
7-Jan-23 10:14am
View
what does k loop do? i and j are rows and columns
Shivam Siddharth
19-Dec-22 12:28pm
View
program is from the tutorial, code from public inheritance section can access getPvt but code from protected section cannot
in protected inheritance when " cout << "Private cannot be accessed." << endl; " is replaced with " cout << "Private = " << object1.getPVT() << endl; " like in the first one it displays above error
Shivam Siddharth
19-Dec-22 10:13am
View
i did what you asked corrected PublicDerived but cant update it since update limit has maxed out
Shivam Siddharth
19-Dec-22 10:11am
View
https://www.programiz.com/cpp-programming/public-protected-private-inheritance
program is from this page, in protected inheritance when " cout << "Private cannot be accessed." << endl; " is replaced with " cout << "Private = " << object1.getPVT() << endl; " like in the first one it displays above error
Shivam Siddharth
19-Dec-22 9:50am
View
link is not available i have updated it before, actual code is with ProtectedDerived and it shows following error:
g++ /tmp/22XqHAz0vQ.cpp
/tmp/22XqHAz0vQ.cpp: In function 'int getPVT()':
/tmp/22XqHAz0vQ.cpp:2:8: error: 'pvt' was not declared in this scope
2 | return pvt;
| ^~~
/tmp/22XqHAz0vQ.cpp: At global scope:
/tmp/22XqHAz0vQ.cpp:4:1: error: expected declaration before '}' token
4 | };
| ^
/tmp/22XqHAz0vQ.cpp:6:41: error: expected class-name before '{' token
6 | class ProtectedDerived : protected Base {
| ^
/tmp/22XqHAz0vQ.cpp: In member function 'int ProtectedDerived::getProt()':
/tmp/22XqHAz0vQ.cpp:10:8: error: 'prot' was not declared in this scope
10 | return prot;
| ^~~~
/tmp/22XqHAz0vQ.cpp: In member function 'int ProtectedDerived::getPub()':
/tmp/22XqHAz0vQ.cpp:15:8: error: 'pub' was not declared in this scope
15 | return pub;
| ^~~
/tmp/22XqHAz0vQ.cpp: In function 'int main()':
/tmp/22XqHAz0vQ.cpp:21:1: error: 'cout' was not declared in this scope
21 | cout << "Private = " << object1.getPVT() << endl;
| ^~~~
/tmp/22XqHAz0vQ.cpp:21:33: error: 'class ProtectedDerived' has no member named 'getPVT'; did you mean 'getPub'?
21 | cout << "Private = " << object1.getPVT() << endl;
| ^~~~~~
| getPub
/tmp/22XqHAz0vQ.cpp:21:45: error: 'endl' was not declared in this scope
21 | cout << "Private = " << object1.getPVT() << endl;
| ^~~~
/tmp/22XqHAz0vQ.cpp:23:32: error: 'class ProtectedDerived' has no member named 'pub'
23 | cout << "Public = " << object1.pub << endl;
| ^~~
Shivam Siddharth
19-Dec-22 9:36am
View
typing mistake sorry, changed PublicDerived to ProtectedDDerived in 2nd program it is still showing error
Shivam Siddharth
19-Dec-22 9:14am
View
program 1 output:
Private = 1
Protected = 2
Public = 3
program 2 output:
g++ /tmp/YAWIi8V4tM.cpp
/tmp/YAWIi8V4tM.cpp: In function 'int main()':
/tmp/YAWIi8V4tM.cpp:34:1: error: 'PublicDerived' was not declared in this scope
34 | PublicDerived object1;
| ^~~~~~~~~~~~~
/tmp/YAWIi8V4tM.cpp:35:25: error: 'object1' was not declared in this scope
35 | cout << "Private = " << object1.getPVT() << endl;
|
Shivam Siddharth
19-Dec-22 5:22am
View
in both programs same thing is being done, private member is accessed with getPvt; in first it can be accessed while in second it cannot be.
Show More